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.

Dark GDK / using two (y and z) rotations at the same time

Author
Message
FaizB110
16
Years of Service
User Offline
Joined: 2nd Jul 2008
Location:
Posted: 7th Aug 2008 23:58
In a racing game i'm making, I'm having trouble using a Y-rotation and a Z-rotation at the same time to cause a motorcyle to both turn (y-axis) and lean (z-axis) at the same time, to create a realistic turning effect. I have tried out many different commands, such as dbYRotateObject, dbZRotateObject, dbRollObjectRight, dbRotateObject, and combinations of them together to achieve the effect, but they always interfere with each other. I need a way to rotate the object based on a universal axis on the Y-axis, and i need a way to simultaneously rotate the object on it's own Z-axis.
some commands of the same type, such as dbRotateObject, allign the object WITH the object's axis so that it is both, however this does not allow turning, and will usually cause the object to quickly rotate in the direction of the universal axis upon which it is rotating, and then undergo the rotation.
I would appreciate anyone giving me a suggestion or their own technique, and I can post the code as well if anyone would like; just reply requesting me to.

__ __ __
|__ ._ |__) /| /| / \
|(_||/_|__) | | \__/
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 8th Aug 2008 14:57
have you tried using Rollobjectright for the tilt and turnobjectright for the actual turning simultaneously?
FaizB110
16
Years of Service
User Offline
Joined: 2nd Jul 2008
Location:
Posted: 9th Aug 2008 06:25
yeah, i did. What happens is that they both happen at the same time, but relative to the object's current position. in a 180 degree turn, i'll end up facing the sky. I'll keep trying though.

__ __ __
|__ ._ |__) /| /| / \
|(_||/_|__) | | \__/
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 9th Aug 2008 12:55
sorry, do it the other way round, turn first then roll. that *should* work
FaizB110
16
Years of Service
User Offline
Joined: 2nd Jul 2008
Location:
Posted: 11th Aug 2008 22:45
nope; it didn't happen. i realized that i can't have the object roll and be rotated on the universal y-axis at the same time since the program will atempt to allign the object with the y-axis. I tried using a combination of roll object, turn object right, and pitch object up. If you think about it, if you tilt an object, rotating it also requires pitching it up also. At 0 degrees tilt, it requires all turn and no pitch, but at 90 degrees tilt,you need only to pitch it up to rotate it. If it is at 45 degrees, it needs to be turned and pitched up at the same rate.
I came up with this:

If you the examples above, if the object is not tilted at all, angle Z = 0, then 0 / 90 = 0, so it should be pitched up 0. (*3 was just for increased speed of turn) 3 - the same operation whose result was 0, is 3 so it should be turned right 3.
If you use a tilt of 45 degrees, 45/90 = 0.5, times 3 is 1.5, so the object should be pitched up 1.5. The remaining, whichis 3 minus that, or 1.5, is given to dbTurnObjectRight. And so on with any other value of tilt.
The only problem is that dbObjectAngleZ gives a value of the object's tilt based on a universal axis, not based on the object's own. Therefore, if the object is tilted, while facing the z-axis, the dbObjectAngleZ will not change at all, and will change at different rates while tilting and facing different angles. Anyone know how I can get the Objects Z angle that is not based on the universal Z-axis???

.__.....__........__
|__.._.|__)/|./|./..\
|(_||/_|__).|..|.\__/

Login to post a reply

Server time is: 2024-11-20 17:29:58
Your offset time is: 2024-11-20 17:29:58