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.

DLL Talk / Newton - How do I prevent an object from spinning?

Author
Message
Game pro
20
Years of Service
User Offline
Joined: 21st Mar 2004
Location: Usa
Posted: 6th Jun 2008 22:20
Okay, so I have my player object (represented as a sphere collision). Player collisions are working fine, and I have it set up to where the player doesn't topple over when you move. However, if I run into another object the player starts spinning...which isn't good for a 3rd person game. There has to be a function that will prevent it from spinning when I hit another object. I just don't know what. Please help?

Check out my dev forums at:
http://z15.invisionfree.com/ProjectRWP
pdq
17
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 6th Jun 2008 22:41
Did you use the "NDB_NewtonConstraintCreateUpVector(Body)" command?
This limits your rotation to a particular axis. You first set the temp vector to the direction of rotation.

For ex: "NDB_SetVector 0.0, 1.0, 0.0" will limit the rotation to the y-axis only.

Hope that helps.
Game pro
20
Years of Service
User Offline
Joined: 21st Mar 2004
Location: Usa
Posted: 6th Jun 2008 22:46 Edited at: 6th Jun 2008 22:51
That's exactly how I have it. I just don't want my player to rotate on the Y axis either when I hit a wall. However, I still want the player to be able to rotate the body(Y axis) using the arrowkeys.

Anyway to restrict rotation on the Y axis, but still be able to rotate the body manually?

Check out my dev forums at:
http://z15.invisionfree.com/ProjectRWP
pdq
17
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 7th Jun 2008 03:43 Edited at: 7th Jun 2008 03:45
Try this code:



Set your vector to what ever value you want omega to be.
Game pro
20
Years of Service
User Offline
Joined: 21st Mar 2004
Location: Usa
Posted: 10th Jun 2008 03:17
Ok, sweet that actually worked. There is another thing I need help with though.

How would I get my Newton object to always have the Y angle face the direction of movement? It's important that my character always facing the direction he is moving.

Check out my dev forums at:
http://z15.invisionfree.com/ProjectRWP
pdq
17
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 10th Jun 2008 22:33
Quote: "
How would I get my Newton object to always have the Y angle face the direction of movement? It's important that my character always facing the direction he is moving.
"


Did you connect your newton "player" body to your character object?

This is the code to do that:


So what ever the newton body does (such as moving and rotating by way of the control keys), the character object will do as well.

Login to post a reply

Server time is: 2024-04-19 18:40:51
Your offset time is: 2024-04-19 18:40:51