Question

I was wondering if there is any event or logic that captures the arrest of a group of 3d objects by gravity.

I have 5 dice, randomly throw in a plane, they collide into the plane, collide with each other, and finally stand still. Once the dice are finished moving, I want to get each rotation XYZ to get the numbers they were.

The only thing I can think of is a timer, but it is not efficient, because the dice are thrown randomly and can take a variable time to stop.

I hope you can help me, greetings.

Was it helpful?

Solution

Sorry maybe i'm missing something but i would just check Linear and Angular Velocities:

var dice : AWPRigidBody;
if(dice.angularVelocity.lengthSquared< 0.01 && dice.linearVelocity.lengthSquared < 0.01)
{
   trace("Stopped");
}

P.S. I've used lengthSquared for performance instead of length

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top