문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top