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 / Help requested with object rotation/movement using a gravity object

Author
Message
Kayl669
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: United States
Posted: 19th Oct 2011 08:25
I am having trouble with moving my gravity object. I have a sphere and a gravity object(box)which is pointed toward the spheres center. Is there a way to rotate and move the gravity object forward and backwards while moving toward spheres center?

Here is what I have so far:



I would like to use the DBPRO rotation commands if possible. But I am lost as to how to make the object move properly using them as the box keeps pointing toward sphere center.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 19th Oct 2011 12:17
You could use rotation matrices.



Where:



Example for rotation on the x axis:



TheComet

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 19th Oct 2011 15:33
@TheComet - Them formulas were what I've been looking for, for quite some time. I think I googled the wrong info so I didn't get it. Thanks...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Kayl669
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: United States
Posted: 19th Oct 2011 19:55
I think I am doing something wrong. It is not working for me:



There must be a simpler way using DBP rotation/position controls. Well, at least the collision detection works
Kayl669
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: United States
Posted: 19th Oct 2011 22:15
Hey, I figured it out! Here is the code:

I just had to reposition the gravity object after moving the player forward or backward.

I really hope this helps everyone in the DBPRO community

Login to post a reply

Server time is: 2026-07-10 04:20:45
Your offset time is: 2026-07-10 04:20:45