0
\$\begingroup\$

Let's assume I have a 1x2x1 cube and it is balanced over an edge, since the weight of the cube is distributed perfectly, it doesn't fall, how to make it fall when part of the cube is over the edge?

enter image description here

I have tried adding invisible objects to both ends of the cube and then adding another invisible object on the edge so when they collide I change the center of mass of the cube, this seems to work but I think it is overly complex since I have to add that invisible object around all edges of my scene.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

https://docs.unity3d.com/ScriptReference/Rigidbody-centerOfMass.html

for falling or everything dependent to physics you need to add rigidBody to it. rigidBody has a property name CenterOfMass. its a vector3 property. you need to position it far from that edge to put force on outer side of that edge.

\$\endgroup\$
2
  • \$\begingroup\$ I already tried that, moving the center of mass to one of the ends of the cube, but how to determine which end? \$\endgroup\$
    – CIOC
    Commented Sep 22, 2019 at 18:18
  • 2
    \$\begingroup\$ @CJ1 you can pot some empty objects child to that box on the edges and do a raycast to check which side is out of the edge and put your center of mass to that position \$\endgroup\$
    – virtouso
    Commented Sep 22, 2019 at 18:22

You must log in to answer this question.

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