MADEAPPS / newton-dynamics

Newton Dynamics is an integrated solution for real time simulation of physics environments.
http://www.newtondynamics.com
Other
942 stars 182 forks source link

Manually setting / adding rotation to Dynamic Body #282

Closed kered59 closed 2 years ago

kered59 commented 2 years ago

Hello all,

Currently I have been tinkering around with Newton Dynamics for a few months but have not found a method to easily rotate Dynamic Body without directly manipulating the Matrix itself.

Is there a method to directly manipulate the rotation of a Dynamic body and if not has anyone found a work around to this or perhaps a easy solution that I could utilize moving forward?

Thanks in advance.

JulioJerez commented 2 years ago

What are you trying to do?

On Mon, Jun 20, 2022, 4:36 PM Derek Lasell @.***> wrote:

Hello all,

Currently I have been tinkering around with Newton Dynamics for a few months but have not found a method to easily rotate Dynamic Body without directly manipulating the Matrix itself.

Is there a method to directly manipulate the rotation of a Dynamic body and if not has anyone found a work around to this or perhaps a easy solution that I could utilize moving forward?

Thanks in advance.

— Reply to this email directly, view it on GitHub https://github.com/MADEAPPS/newton-dynamics/issues/282, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6EPJH5VKGHTMUV7LNKH3TVQD6BTANCNFSM5ZKMEBXQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kered59 commented 2 years ago

I am trying to directly set the rotation of an object without applying forces. If needed I can provide an example.

JulioJerez commented 2 years ago

When you say, set the rotation. What do you mean?

A rotation is a transform matrix. If this is what you mean, there is a joint called Kinematic joint that let you manipulate a body by setting a target transform. In the demos this is what is use to pick objects from the scene.

On Mon, Jun 20, 2022, 6:53 PM Derek Lasell @.***> wrote:

I am trying to directly set the rotation of an object without applying forces. If needed I can provide an example.

— Reply to this email directly, view it on GitHub https://github.com/MADEAPPS/newton-dynamics/issues/282#issuecomment-1161082430, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6EPJBIAO5JB7VSYNH2ML3VQEODJANCNFSM5ZKMEBXQ . You are receiving this because you commented.Message ID: @.***>

kered59 commented 2 years ago

Thank you for your input, could you give a brief example here of how to use the joints for this? In case someone else comes across the same issue.

Setting the rotation directly is a reference to providing a vector of rotational values and having the object adopt that rotation directly without the need for extra steps. I had a method to manipulate the matrix directly but am lacking in capability to do it efficiently at this time hence asking if there were any alternatives.

Greatly appreciate the input!

JulioJerez commented 2 years ago

in the demos file ..\newton-dynamics\newton-4.00\applications\ndSandbox\ndDemoCameraManager.cpp line 275

is the code that makes a joint and attaches it to a body.

 m_pickJoint = new ndDemoCameraPickBodyJoint(body,

scene->GetWorld()->GetSentinelBody(), posit, this); scene->GetWorld()->AddJoint(m_pickJoint); m_pickingMode ? m_pickJoint->SetControlMode(ndJointKinematicController::m_linear) :

m_pickJoint->SetControlMode(ndJointKinematicController::m_linearPlusAngularFriction);

m_pickJoint->SetMaxLinearFriction(mass.m_w * linearFrictionAccel);

m_pickJoint->SetMaxAngularFriction(inertia * angularFritionAccel);

the the Joint has functions for setting the transform

On Mon, Jun 20, 2022 at 7:29 PM Derek Lasell @.***> wrote:

Thank you for your input, could you give a brief example here of how to use the joints for this? In case someone else comes across the same issue.

Setting the rotation directly is a reference to providing a vector of rotational values and having the object adopt that rotation directly without the need for extra steps. I had a method to manipulate the matrix directly but am lacking in capability to do it efficiently at this time hence asking if there were any alternatives.

Greatly appreciate the input!

— Reply to this email directly, view it on GitHub https://github.com/MADEAPPS/newton-dynamics/issues/282#issuecomment-1161129999, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6EPJFLJ7EESMR3A5OSIU3VQESJBANCNFSM5ZKMEBXQ . You are receiving this because you commented.Message ID: @.***>

kered59 commented 2 years ago

Big thanks again!