|
Usage<RigidBody> world.createRigidBody(string rigidbodyname, string 3Dmodelname,symbolBodyProxy,symbol bodyType,symbol flipNormals)
DescriptionThis
method creates a rigid body with the specified proxy shape.
The
#meshdeform modifier must be added to the model before creating
a rigid body. A -21 error is displayed when the meshdeform modifier
is not added to the 3D model.
Note: For creating dynamic concave
rigid bodies, see CreateRigidBodyFromProxy().
Parameters
Parameter
|
Description
|
3dModelName
|
Required. String that specifies the name
of the 3d Model on which the rigid body is created.
|
rigidBodyName
|
Required. String that specifies the name
of the rigid body.
|
symbolBodyProxy
|
Required. Symbol that takes the following
values.
#box
#Sphere
#convexShape
#concaveShape
|
bodyType
|
Required.
#static - If a static or
immovable body needs to be created. Note: When you move a static
body by changing its position, the position of the rigid body changes
but the position of the 3D model is unaltered.
#dynamic
- If a movable body needs to be created.
|
flipNormals
|
Optional.
This parameter inverts
the face normals.
For bodies using #concaveshape proxy, collisions
are detected in the positive direction of the face normals. Penetration
is observed from the opposite side. To invert this behavior, use
FlipNormals.
This parameter works only with #convexshape and
#concaveshape proxies. It throws an error for other proxies.
|
A reference to the rigid body is returned.
If the creation fails, void is returned.
Note: A
rigid body using #concaveshape proxy must be #static. A -28 error
is thrown if you try to create a concave dynamic body. See createRigidBodyFromProxy(). for creating
dynamic concave rigid body.
Example--Lingo syntax
objRigidBody = member("PhysicsWorld").createRigidBody("RigidBodyA","ModelA",#sphere,#static)
objRigidBody = member("PhysicsWorld").createRigidBody("RigidBodyA","ModelA",#box,#dynamic)
objRigidBody = member("PhysicsWorld").createRigidBody("RigidBodyA","ModelA",#convexshape,#dynamic)
objRigidBody =member("PhysicsWorld").createRigidBody("RigidBodyA","ModelA",#concaveshape,#static,#flipNormals) --The last parameter,#flipNormals,is optional.
//JavaScript Syntax
var objRigidBody = member("PhysicsWorld").createRigidBody("RigidBodyA","ModelA",symbol("sphere"),symbol("static"));
var objRigidBody = member("PhysicsWorld").createRigidBody("RigidBodyA","ModelA",symbol("box"),symbol("dynamic"));
var objRigidBody = member("PhysicsWorld").createRigidBody("RigidBodyA","ModelA",symbol("convexshape"),symbol("dynamic'));
var objRigidBody =
member("PhysicsWorld").createRigidBody("RigidBodyA","ModelA",symbol("concaveshape"),symbol("static"),symbol("flipNormals"));//The last parameter, symbol("flipNormals"),is optional.
|
|
|