Skip to main content
gamedev.net
🔒 Locked

Physx

Started by zhou__yu Jul 1, 2006 at 1:39 AM 3 replies 1.2k views
Original Post
zhou__yu
zhou__yu
I am a beginer.I want to create a scene that a stone crash the other stone and the latter split apart by using Physx SDK.The whole process ,the movement and spliting of the stone was implement by real time computation.But I don't know how to do.Who can help me?(I am a Chinese.So my English is so poor.I hope you can understand my meaning.)
grhodes_at_work
grhodes_at_work
A stone will break into pieces when the internal stresses exceed the ultimate stress of the stone. PhysX does not compute the internal stresses at all. In fact, it doesn't compute stresses at all. It only computes boundary/reaction forces and torques (also known as moments). This is true of most rigid-body engines. Engines that natively support soft body elements will likely compute stresses directly. But even though you can simulate soft bodies with PhysX and other such engines, they are not native soft body engines....

So, even though PhysX doesn't compute the internal stresses that lead to fracture, it is possible to simulate fracture with PhysX and other rigid body engines.

To simulate a stone that can break into pieces, using PhysX or any other pure rigid-body engine, you must model the stone as multiple rigid bodies, linked together with rigid body constraints. It should be possible to extract the constraint forces at each time step. You can then break the joints if the constraint forces exceed some limit value that approximate the strength of the stone. This is the typical approach. The initial challenge, then, is deciding how to model discretize the stone into pieces---each piece ultimately being one of the rigid bodies that make up the whole stone. The breaking of the constraints will be rather easy, except that it may be tedious to choose the limit forces for the breaks.

I hope this helps. Please tell me if I have used any English that you find difficult. I may be able to answer in a different way, if any of this is unclear.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Promit
Promit
By the way, I believe PhysX allows you to specify the force at which a joint breaks, so you don't need to introspect into the joint forces yourself.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Alpha_ProgDes
Alpha_ProgDes
I don't know if this is any simpler or even accurate but... make a 3D model of a rock that has (for this example) 6 parts. Give this rock a value that says how much force it can resist. Now when something hits this rock, you calculate the force applied to the rock. If the force applied to the rock is more than the force the rock can resist, then the rock breaks into 6 pieces.

I hope that's simple enough to understand. [smile]
Beginner in Game Development?  Read here. And read here.  
grhodes_at_work
grhodes_at_work
There is also an easier way to do this. I would recommend this simpler approach, for beginners:

1) Model each stone as one rigid body. No rigid body constraints or fancy stuff.

2) Setup to receive notice when a collision occurs.

3) When there is a collision between stones, if the collision force is larger than some limit, decide to break the stones apart.

4) When you decide to break a stone (one rigid body) apart, delete the original stone object and replace it with two or more smaller stones, each being a single rigid body.

5) When you create smaller stones to represent a broken larger stone, choose them such that the total mass of the smaller stones is equal to the mass of the original larger stone.

6) If you understand how, set the initial velocities of the smaller stones such that their linear momentum matches the linear momentum of the larger stone, after the collision that caused its breakup.

7) If you understand how, also set the initial rotational velocities of the smaller stones such that their total angular momentum matches the angular momentum of the larger stone, after the collision that caused its breakup.

Steps 1 through 5 are quite easy, and do not require much knowledge of physics. Futher, it eliminates the need to discretize the original large stone. This will enable simpler models, fewer constraints to solve each timestep, and much faster runtimes.

Steps 6 and 7 require a bit more knowledge of physics.

You really should do step 6, at least, if you want the collision/breakup to look sort of realistic.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.