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 / Free Form/Rotation Commands

Author
Message
Gardocki
17
Years of Service
User Offline
Joined: 31st Oct 2002
Location:
Posted: 31st Oct 2002 08:12
I know this topic has been discussed before (probably extensively). Is there any way to get useful rotation of an object on all 3 axes? I am trying to control an aircraft such that up/down on the joystick controls pitch and left/right controls turning and banking. Whenever I add a third axis, the motion will mess up after a 90-degree turn in any direction. I know there is a work-around somewhere, but I can't find it.
D Man
17
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Germany
Posted: 31st Oct 2002 19:19
I think I know what you mean.
I had this problem too, but I fixed it by using
"fix object pivot" after loading and rotating the object in the right direction.

Hope that helps

"If you can't make it good
make it look good."
Bill Gates
Gardocki
17
Years of Service
User Offline
Joined: 31st Oct 2002
Location:
Posted: 31st Oct 2002 19:34
That's not quite what I mean. Here's a more detailed explanation of my problem:

-My model, a spacecraft is loaded into DBPro and positioned.
-Then, I put the following code in the Do/Loop

Do

Turn Object Right 1,(Joystick X()/75)
Roll Object Right 1,(Joystick X()/75)
Pitch Object Down 1,(Joystick Y()/75)

Loop

I expected this code to make the ship perform like an aircraft, which turns and banks in unison. This is exactly what it did, for the first turn. After my turn got to 90-degrees left or right, the banking and turning flipped somehow, and after that when I turn left on the joystick, the ship moved right and banked left, or banked left and moved right, depending on where the ship was in relation to its original starting point.

I think this happens because Pitch, Roll and Turn do not modify the object's XYZ axes, just the mesh itself. However, the same problem arises when I use the Rotate Object command.

Funky Frank
17
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 31st Oct 2002 22:03
An old workaround (i.e. this works in DB1) is as follows :-

Create a second object to go with your 'aircraft'.

Make this second object invisible to the user and place it so its centre coincides with the centre of your aircraft.

Link your craft and the new object using the 'glue object to limb' command.

Now when you want to apply transformations to your craft, apply two of the three rotations to your original object, but the third rotation is applied to the dummy object.

I think i'm right is saying this method was used in the original tank demo a long while back.

Hope this helps.

FF
rapscaLLion
17
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 31st Oct 2002 22:51
ya, I was going to suggest something like that.

Make the invisible object, and use all the movement on that. Ie- Turning, moving forward. Then do all the rotation ie- banking, rolling on the actual plane model, and set the plane's x,y,z values to the Invisible Object's values.

Alex Wanuch
aka rapscaLLion
Get the DB Weekly Newsletter at www.dbwn.cjb.net
Gardocki
17
Years of Service
User Offline
Joined: 31st Oct 2002
Location:
Posted: 31st Oct 2002 23:14
I still can't get it to work. Maybe I'm doing something wrong. here's my code:


Login to post a reply

Server time is: 2020-07-14 21:45:25
Your offset time is: 2020-07-14 21:45:25