0
$\begingroup$

Can the limit location constraint be applied to an object that is participating in rigid body collisions?

I have a rigid body ball that's bouncing up and down off of a spring-loaded rigid body paddle (with a little help from an upward force under the paddle). The paddle wants to add some X,Y motion but I want that to be ignored so I locked the ball's X and Y location transformation. That keeps it bouncing on Z in the animation. And this works fine, -ish. The issue is, at a certain frame, I want to allow that X and Y motion.

So I got rid of the transform locks and added a Limit Location Constraint to the ball. I set the X and Y max and min to 0 (the ball is in fact at 0,0,z). But it apparently has no effect in the rigid body sim. The paddle hits the ball, and the ball immediately deflects in all three dimensions.

Am I misunderstanding what that constraint does?

Is there any other way to do this?

Ex: Here's a cube falling onto a plane. The Limit Location Constraint works fine as long as the plane is flat. The cube bounces, but keeps its origin on x=0,y=0. But if you tilt the plane... oops

$\endgroup$
1
$\begingroup$

Objects are either under the control of the animation system-- which includes f-curves and constraints-- or else they are under the control of the physics system. There is no in-between.

If you would like to have an object that copies the Z location of an object, you can disable rendering on your rigid body, then make a new object that copies the Z location of the non-rendering rigid body. Then, you can animate the influence of that constraint, and/or use it in conjunction with other constraints, to control exactly when the object is copying the Z location and, perhaps, when it is copying the XYZ location. I doubt this is what you want, though-- if you switch suddenly to copying XYZ location, the object will jump, because your physics have been moving in XY for a decent chunk of time, ignored by that object.

enter image description here

A different option here, which is what I would recommend considering, is to create non-rendering rigid body physics that act the way you would like them to act. If you want the cube to bounce straight up, then it can bounce off of a level but invisible collider. Or, make an invisible collider wall, to keep the cube from moving in one or more directions. These colliders can have the "animated" trait enabled, allowing you to move them out of the way whenever you want different behavior for your physics. There's no reason that you have to render what your simulation sees.

enter image description here

Colliders aren't the only way you can gain control of a physical system; you can also use animated rigid bodies that are joined to a simulated rigid body via a rigid body constraint.

A final option here is bake your rigid body simulation to keyframes, then edit those keyframes, and then use them as the beginning of a rigid body sequence, during which the cube has the "animated" trait. Any linear or rotational velocity will be recalculated based on the last animated frame.

enter image description here

$\endgroup$
1
  • $\begingroup$ Collider walls work in my situation. Thanks! $\endgroup$
    – cleek
    Nov 21 '21 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.