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.

DarkBASIC Professional Discussion / 3D rotation question

Author
Message
TonyP
22
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 28th Oct 2003 15:56
Hi,

I would like to roll a 3D object in the same way Marble madness rolls. I tried to code this but whenever I rotate the object, it looks like it is rotating back towards me.

Help greatly appreciated.
Scraggle
Moderator
23
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Oct 2003 16:29
It's difficult to offer any help without seeing your code.

But if by 'rolling back towards you' you mean 'out of the screen' then it sounds like your problem is with rotating about the X axis. If you are increasing your X angle of rotation then decrease it and vice versa that should alter the effect.
TonyP
22
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 29th Oct 2003 14:05
Code attached. Use cursers to move. Basically, i need the axis of the object to alway's face the screen. If you rotate the object a quarter turn forward and then left, the axis is no longer left in relation to the screen.

Agian, Help greatly appreciated.
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 29th Oct 2003 16:49
its rotating correctly on my system... a few things...

1) might be better if you are not hitting any keys the object will slow down to a stop
2) roll and pitch are independant of any axis... it goes off of the current angle they are pointing... when you pitch the object it rotates forware... if you wait 1/2 a revolution and 'roll object left' (counter-clockwise)... it will appear to roll clockwise (rolling left for object)...
3) noticed that the camera follow command has a 'objangle#' variable... this equals 0 (by default)... and it is never changed ANYWHERE!

my suggestions: make a cube, move it forward/back when up/down is pressed, rotate left/right when left/right is pressed... get this working first! (basics of the movement), have the camera follow this object... now, hide the object!... make another cube (or sphere, cube easier to test functionality), set up the rotation of this object for how the hidden cube is moving, then move this object to the same position as the first cube... what this all will do (when set up correctly) will move the object forward and rotate forward when the upkey is pressed, and when left/right is pressed will rotate the object (keeping it on a single plain) and roll the object for visual appearance only!...

with the code you have now... when you start putting in movement... the cube will act as a spaceship would... moving freely in a 3D space... and if you put it on a flat surface... it will mess up BIG time!

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro 128mb 8xAGP, XP Pro
TonyP
22
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 30th Oct 2003 02:28
Not quite sure I understand your solution?

i agree that the program is rotating the cube correctly (working fine) but this is not the effect I am after. I basically want to emulate a ball rotating towards and away from the 'screen', independant of it's axis. Is there anyway i can reset or change an objects axis to that of the screen or camera?

Even better if someone has a code example or psuedo code.

Login to post a reply

Server time is: 2026-07-26 16:03:27
Your offset time is: 2026-07-26 16:03:27