A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by AntonSynytsia » Thu Feb 08, 2018 3:09 pm
Currently, to apply acceleration, we use NewtonUserJointSetRowAcceleration function.
If we want to apply force, we divide the force by the masses of two linked bodies, so as to convert force to acceleration, before passing it to NewtonUserJointSetRowAcceleration function.
(And just so there is no unnecessary computation done, we precompute the inv_total_mass = (1.0 / (parent_mass + child mass)) and update it whenever the masses are changed or a body is set static.)
Is there a better way to set row force, perhaps like a function NewtonUserJointSetRowForce?
-
AntonSynytsia
-
- Posts: 193
- Joined: Sat Dec 28, 2013 6:36 pm
by JoeJ » Thu Feb 08, 2018 3:33 pm
If you already know the force, there is no need to use a joint and you can use force torque callback.
What do you try to do?
-
JoeJ
-
- Posts: 1453
- Joined: Tue Dec 21, 2010 6:18 pm
by AntonSynytsia » Thu Feb 08, 2018 3:44 pm
Ah, yes, the force and torque is a good approach... I was just wondering if there was such a thing for a joint. Thanks
-
AntonSynytsia
-
- Posts: 193
- Joined: Sat Dec 28, 2013 6:36 pm
by JoeJ » Thu Feb 08, 2018 4:20 pm
To make it clear, here's an example, say we want a mechanic in a game where the player can pick up crates and move them around.
We can do this with forces, because they are easy to calculate for a single object.
But if he picks up a corpse built by a ragdoll, it becomes harder, because we don't know what mass we should use. Mass of the single body we pick is too less, and summed mass of all bodies is too large if some bodies are resting on the floor for example.
Here a joint for picking is ideal, because Newton calculates forces for all bodies, considering all their joints including contacts. The ragdoll will follow the single body we picked with the acceleration we want.
So joints are mainly useful for problems involving multiple bodies.
-
JoeJ
-
- Posts: 1453
- Joined: Tue Dec 21, 2010 6:18 pm
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 35 guests