CodeRecipe( );

one stop for all game coders..

For better display use Firefox Browser.Simply go to: GetFirefox.com
Follow us on Twitter
Home
Rigid Body creation - D11 Print E-mail
User Rating: / 3
PoorBest 
Written by CR Team   
Saturday, 18 July 2009 07:52

What is a rigid body ?
In physics, a rigid body is an idealization of a solid body of finite size in which deformation is neglected. In other words, the distance between any two given points of a rigid body remains constant in time regardless of external forces exerted on it. ( Source

Unlike soft bodies rigid bodies cannot deform in shape when external forces act on it. We will be talking only about rigid body creation wrt to Adobe Director.

Rigid bodies can be created using the following set of method ( only in Director 11.5 ):rbody

Have linked all of the above methods to the live docs of Director 11.5. The proxy template creations being the new methods added in Director 11.5.

In order to create rigid body which are not of type dynamic concave and simple in shape ( less polygon count )  one can use the createRigidBody() method out of the box.

createRigidBody() method:

syntax :

createRigidBody()
1
2
3
4
--physX = member("physX")
physX.createRigidBody(string rigidbodyname, string 3Dmodelname,symbolBodyProxy,\
symbol bodyType,symbol flipNormals)
--returns a handler to the rigid body

symbolBodyProxy:

  • #concaveshape - The proxy/bounding physics shape for a 3d model will stick to the surface of the model
  • #convexshape - The created proxy with be like a plastic wrap around the model
  • #box - The 3d model is encapsulated in a box shaped proxy
  • #sphere - The 3d model is encapsulated in a sphere shaped proxy
bodyType:
  • #dynamic - rigid bodies can move around in the 3d+physics world ( cannot be used with #concaveshape )
  • #static - rigidbodies cannot move in the 3d + physics world ( stuck for life ;) )
flipNormals: optional parameter,  when you see a model sink or only involves itself in collision from the side not intended by you , flipNormals comes to the rescue.

The createRigidBody( ) method can be used to create rigid bodies at runtime , the only draw back being that one cannot create dynamic concave rigid bodies with this method.

You can use the newly provided proxy template workflow to create dynamic concave rigid body.