I'm creating two rigid bodies and then setting a hinge constraint with pivot = (0,0,0) for one of them and then moving the other body. I thought this meant that the object with the non-zero pivot would essentially act as an anchor for the other one, without having its movement affected by it.
However, if I apply an impulse to the parent body, its movement is affected by the child object.
For example:
Code: Select all
// with:
body_A_mass = 1
body_B_mass = 150
body_A_pos = (30, -15, 0)
body_B_pos = (0, -5, 0)
body_A_pivot = (0, 0, 0)
body_B_pivot = (30, -10, 0)
axis = (0, 1, 0)
// if I do the following, I can then see the position vary slightly over time in the Y axis rather than just X
body_B->SetLinearVelocity(30, 0, 0)
Am I doing something wrong here or is there another way to create an anchored object that does not affect the parent? I've looked at fixed constraints but they seem pretty soft and also tried doing this with a reduced mass difference but it only made the issue more noticeable (since I'm guessing that the constraint effectively shifts the center of mass).
Thanks in advance for any help.
Edit: I did find a workaround, which was setting the parent body's mass extremely high but that seems very hackish.