Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / first go and need a box to spin around

Author
Message
viking
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 22nd Jun 2008 05:04
i am trying to get a box to spin around using the arrow keys. it worked fine when darkbasic created the box for me, but when i tried to add my own 3ds file, it wouldn't work. i think it has to do with the camera but i have played around for up to 4 hours and still cant work it out

all help apreciated

(all files attached)

Attachments

Login to view attachments
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 22nd Jun 2008 14:28 Edited at: 22nd Jun 2008 14:46
your code:


issue 1:
you've loaded the box as object 2 (Boxobj = 2) but when you try to rotate it, you're using the x and y angles of object 1 (there is no object 1). make sure you're rotating Boxobj and basing the rotation on the x/y angles of Boxobj.

issue 2:
up/down/left/right-key() will never = 2.
read the help file for (any of) those commands. the fix is simple (and the help file is only 1 sentence long).

issue 3:
you've set sync on which means you have to call sync to refresh the screen. add sync to the bottom of your do/loop.

issue 4:
you've scaled the object to 5% of normal. as it stands (and with the set object parameters you've set), you'll have a hard time seeing the box rotate.

summary:
1) proof-read your code & double-check variables. you would have noticed the object 1/2 confusion.

2) take the time (it only takes a second) to review the help files for each command; you're setting yourself up for a lot of frustration otherwise.

3) please don't offer a 'tutorial for noobs' until you have a grasp of the commands yourself. we all appreciate the help we find on the forums, and i know it is your intention to provide just that, but it's "3 steps backward" for anyone reading a tutorial with mis-information. i've done it myself and it's not a good feeling when you've lead someone astray/caused additional confusion.

4) spending 4 hours on 20 lines of code means you've probably racked your brain pretty hard. it's a good habit to step away from your code and get some fresh air regularly; you might have caught some of mistakes with a fresher mind

good luck

ps: the box object and the camera are adequate enough to produce the results you appear to be shooting for.

Virtual Nomad
AMD XP 1800+ (~1.6 Ghz) / 1.5 GB RAM
ATI Radeon 8700LE 128 MB / Windows XP
viking
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 23rd Jun 2008 11:49
thanks for that this should help me.

Login to post a reply

Server time is: 2024-09-27 16:26:05
Your offset time is: 2024-09-27 16:26:05