- Home /
The question is answered, right answer was accepted
How do I make rigidbody balls to roll after stacking?
I stack rigid body balls as the following
o
o
o
o
----- -> Plane
Each ball has a rigid body and capsule Collider component, with a mass of 1, zero drag and ice material assigned to them. When I press the play button, the stack of ball stands still! Amazement! I changed the mass to 1000 and the stack of balls stands still.
My fixed time = 0.005, and physics iteration = 100, min penetration = 0.01.
Question : how do I make the balls roll down realistically instead of stacking and standing still?
Edited :
I tried adding space as suggested in the comment below, but the pillar of balls stood still.
Additionally, I increased the count of 4 balls to approx. 128 balls, the result is the same. A standing pillar of icy balls.
$$anonymous$$y first guess would be to put some space between them. Let them fall down ontop of each other.
If that doesn't work, offset them a little and let them fall.
@TobiasP I tried that. Adding a little more space. Adding greater space only made the stack to be formed longer. But no falling down like stacking marbles in real-life.
Answer by Kiloblargh · Mar 21, 2014 at 04:15 AM
This is the "realistic behavior" of perfectly balanced, perfectly aligned, perfect spheres sitting perfectly motionless on a perfectly flat plane with no atmosphere. That's just not a realistic situation to find in the real world.
You need a script something like this:
var ballTs : Transform[];
var ballRBs : RigidBody[];
function Start () {
for (var ballT : Transform in ballTs) {
ballT.position += Vector3 (Random.Range (-0.05, 0.05), 0.0, Random.Range (-0.05, 0.05) );
}
for (var rb : RigidBody in ballRBs) {
rb.AddForce (Random.Range (-0.25, 0.25), 0.0, Random.Range (-0.25, 0.25), ForceMode.VelocityChange);
}
}
Follow this Question
Related Questions
How does Unity3d uses nvidia's PHYSX engine? 0 Answers
The Physics of Ball Spin in Tennis, Topspin and Backspin 3 Answers
Physics.Simulate time increases exponentially relative to rigidbody count 1 Answer
gPhysicsSDK->setParameter(NX_ADAPTIVE_FORCE, 0); 0 Answers
Ways to work around OnCollisionStay/Enter events firing one frame late? 2 Answers