clamping child to parent

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

clamping child to parent

Postby blackbird_dream » Fri Dec 08, 2017 6:33 am

I'd like to clamp a child rigidbody to its parent, i.e. fix all the relative dofs between the 2 bodies.
In Unity, I thought I just had to create a child gameobject, assign a rigid body to it but in reality it doesn't behave as a clamp joint: the child object can turn and move freely from its parent.
As an example I build a vehicle composed of a cube and 4 wheels (they are defined as rigid bodies with a procedural reaction force).
If I just declare the 4 wheels as children, they quickly split off from the chassis.
I need to add a hinge joint (joint axis set vertical) to each wheel to clamp it to the vehicle.

My first question is what is the interest of the hierarchical description of bodies except setting the position and orientation in relative coordinate systems ?

If I want to fix the hinge joint dof how can I do that ? Or is there another joint to be used instead that can lock all 6dofs ?
Last edited by blackbird_dream on Fri Dec 08, 2017 5:28 pm, edited 1 time in total.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: clamping child to parent

Postby Sweenie » Fri Dec 08, 2017 1:08 pm

Placing rigid bodies in a hierarchy in unity serves no purpose other than handling initial placement of bodies in the editor in a parent/child way with hiearchy transforms(which can quickly get annoying with different scales)

In the physics engine all bodies are free moving bodies restricted by constraints.

I prefer to not place the rigid bodies in a parent/child hierarchy but instead create an empty gameobject as a group object and then create for example a chassi and wheels side by side in a flat structure inside.
This makes it easier to scale individual objects without scaling the children as you mentioned in the other thread.

Regarding the joints.
There is a joint in the customjoints lib called Custom6DOF, i suppose that could act as a fixed joint if enabling the limits for all 6 dof. But i dont think we have implemented that joint in the plugin yet. Either you will have to wait until we implement it or if you are in a rush, implement it yourself. There are plenty of joints already implemented in the plugin so it should be a trivial task if you check how they were implemented. The universal joint would probably be a good reference.
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: clamping child to parent

Postby blackbird_dream » Fri Dec 08, 2017 5:25 pm

thks for this very clear and helpful answer.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 13 guests