0
$\begingroup$

In rigid body physics my active ball is bouncing from passive object to object. How can i control this physics so that ball will bounce only Y and Z axis not move to X direction. My passive objects shapes are different so going to X direction how to stop it? I don't want any movement along X axis.

$\endgroup$

1 Answer 1

1
$\begingroup$

Simple answer: no, there is nothing like a "limit location" or "limit direction" constraint or anything, the rigid body ball will bounce where the physics carry it.

But: of course you can limit the rigid body with additional passive rigid bodies to only go where you want it to. For example, this ball is rolling down a crooked staircase and gets carried away to the side:

ball bouncing off

Now let's say I don't want this. I want the ball to just roll straight down the staircase although the path is crumpled.

What I do now is I place two new cuboids as passive rigid body objects to the left and right of the ball. The closer they are, the more restricted the ball's side movement will be.

additional passive collision objects

The good thing is, you can make them invisible in the viewport (although there I would just set them to wireframe instead of completely invisible so you can still select and move them) and invisible for the render. As long as they are in the scene, they will affect the active rigid body which results in this:

ball bouncing restricted

The only problem with this method is, the more the ball might be bouncing around, the more obvious and unnatural it might look that the ball is trapped in invisible boundaries. But this problem you might have if there existed some location constraints for the simulation as well.

By the way, if you have more active rigid bodies in your scene and you do not want all of them to be affected by those walls, you can assign rigid body objects (active and passive) do different rigid body Collections (not the regular ones in the Outliner) in the Rigid Body properties directly:

rigid body collections

By clicking or Shift+clicking for multiple selections you can assign rigid bodies to different collections to decide whether they can interact with each other or not.

In the following example I have colored the objects to show to which collection they belong to: blue is the first, red the second and green the third collection. One ball is blue/red to show it is assigned to the first and second collection, the other is blue/green which means the first and third collection.

The balls can interact with each other since they are both blue and with the other blue objects. The red collision object only affects the blue/red ball though, and the green object only the blue/green ball:

interaction between collections

So in the earlier example you could make one ball being restricted in which direction it is bouncing while other objects can be set to pass through the walls, like in the next animation, where the second ball is free to move off to the side:

different effect on balls

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .