Lock transformation of rigid body on axis

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Lock transformation of rigid body on axis

Postby kwitee » Wed Apr 13, 2011 2:48 am

Hi,
I am developing a simple game using Irrlicht for graphic and Newton for physic. I want to lock rotation of rigid body on some axis, so it doesn´t flip over. I tried to set very high inertia vector for that body, it became harder to rotate, but it is still possible.
I hope I posted it to right forum.
kwitee
 
Posts: 2
Joined: Wed Apr 13, 2011 2:05 am

Re: Lock transformation of rigid body on axis

Postby JernejL » Wed Apr 13, 2011 5:38 am

It is possible to do it with a "upvector" joint.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Lock transformation of rigid body on axis

Postby kwitee » Wed Apr 13, 2011 6:17 am

Thanks for reply, but now I am confused. Can you show me link to newton wiki or a few lines of code how to do this? I am new to newton.

I found my own solution:
Code: Select all
CMatrix4<f32> matrix; // irrlicht 4x4 matrix
NewtonBodyGetMatrix(body,matrix.pointer()); // get the matrix
mat.setRotationDegrees(vector3df(0.0f,0.0f,0.0f)); // set rotation of matrix to 0,0,0
NewtonBodySetMatrix(body,matrix.pointer()); // put the changed matrix back

I put this in my SetMeshTransformCallback, but it is not 100% OK I think
kwitee
 
Posts: 2
Joined: Wed Apr 13, 2011 2:05 am

Re: Lock transformation of rigid body on axis

Postby JernejL » Wed Apr 13, 2011 2:27 pm

see: NewtonConstraintCreateUpVector
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron