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 Physics & Dark A.I. & Dark Dynamix / Making gravity point 'down' regardless of rotation?

Author
Message
Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 13th Mar 2009 10:22
I'm working on a little demo, and this is the first time that I've really used Dark Physics.

Here's some code, so you can see what I'm doing currently:


The plan is to allow the user to left click on the grid to create a line of little blocks. Then right click above them to drop a ball. You should then be able to use the left and right arrow keys to rotate the scene, and the ball will roll down the line of blocks.

For this to happen, gravity constantly needs to be re-vectored so that it points "down", and this is the bit that I don't really understand. I'm pretty sure I won't need a Z component, as there will be no 'in-and-out', I just need to get the X and Y component.

Any help on how to work this out would be appreciated.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Mar 2009 02:31
phy set gravity sin(camera angle z(0))*-9.8,cos(camera angle z(0))*-9.8,0

That should do what you need.


The one and only,


Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 14th Mar 2009 02:39
Excellent. It needed one minor tweak, so that it reads: phy set gravity sin(camera angle z(0))*9.8,cos(camera angle z(0))*-9.8,0

But my gravity is now doing what I need it to. Thanks
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Mar 2009 05:06
No problem.


The one and only,


Login to post a reply

Server time is: 2024-05-18 13:20:52
Your offset time is: 2024-05-18 13:20:52