Logo

sbPhysics v0.2.4 - Enhanced Physics Plugin for Shiva3D

Error message

Warning: preg_match() [function.preg-match]: Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 2112 in truncate_utf8() (line 340 of /home/digital1/public_html/synapticbytes/includes/unicode.inc).

  This is a Demo version with the below functionality mostly working, although with limited error checking, so caveat emptor. It will exire in February, 2013  

 

*** API Functions ***
 
bOK = createShape2D (sObjectTag, nMass, nShapeHint, nP1, nP2, nP3, nP4, nP5, nP6 ) 
"Creates a 2D shape assuming the shape hint given, and with option parameters depending on the shape hint"
bOK = setElasticity (sObjectTag, nElasticity ) 
"Set the elasticity of the body"
sNextBodyObjectTag = getNextBody (sPreviousBody ) 
"Returns the Shiva object tag for the physics body in the list of bodies after the one input.\nUse 'First' to start at the beginning of the list"
bOK = setFriction (sObjectTag, nFriction ) 
"Sets the friction value of the body"
bOK = setRollingFriction (sObjectTag, nRollingFriction ) 
"Sets the rolling friction value of the body"
bOK = setAnisotropicFriction (sObjectTag, nAnisoFrictionX, nAnisoFrictionY, nAnisoFrictionZ ) 
"Sets the anisotropic friction value of each axis of the collision body set for this object"
about ( ) 
"Displays development information about the plugin in a dialogue"
nNumberOfBodies = getBodyCount (kBodyType ) 
"Returns a count of the number of bodies of the specified body type in the current dynamic world. \nIf no body type is specified, a count of all bodies is returned."
bOK = wake (sObjectTag ) 
"Activates the specific object in the current dynamic world"
bOK = wakeAll ( ) 
"Activates all rigid bodies in the current dynamic world"
bOK = deleteConstraint (nConstraintID ) 
"Removes the selected constraint from the current world"
nConstraintID = addHinge (sObjectTagA, nPivotXA, nPivotYA, nPivotZA,  nAxisXA, nAxisYA, nAxisZA, sObjectTagB, nPivotXB, nPivotYB, nPivotZB, nAxisXB, nAxisYB, nAxisZB, bDisableLinkedCollisions ) 
"Adds a Hinge constraint to ObjectA and optionally ObjectB at the nominated pivot points, hinged along the nominated axes. Objects must previously have had rigid bodies assigned to them."
nConstraintID = addSlider (sObjectTagA, nAxisXA, nAxisYA, nAxisZA, nAngleA, sObjectTagB, nAxisXB, nAxisYB, nAxisZB, nAngleB ) 
"Adds a Slider constraint to ObjectA and optionally ObjectB along the nominated axes at the nominated angles. Objects must previously have had rigid bodies assigned to them."
nConstraintID = addConeTwistConstraint (sObjectTagA, nAxisXA, nAxisYA, nAxisZA, nAngleA, sObjectTagB, nAxisXB, nAxisYB, nAxisZB, nAngleB ) 
"Adds a Cone Twist constraint to ObjectA and optionally ObjectB. Objects must previously have had rigid bodies assigned to them."
bOK = setBodyGravity (sObjectTag, nGravityX, nGravityY, nGravityZ ) 
"Sets the Gravity value to be used for this object when applyBodyGravity is activated"
bOK = applyBodyDamping (sObjectTag, nTimeStep ) 
"Damps the object velocity using the set linear and angular damping"
bOK = applyBodyGravity (sObjectTag ) 
"Applies the gravity value previosuly set for the object"
bOK = clearBodyForces (sObjectTag ) 
"Removes all forces from the selected object\n"
bOK = applyBodyTorque (sObjectTag, nTorqueX, nTorqueY, nTorqueZ ) 
"Applies torque to the selected object"
bOK = applyBodyTorqueImpulse (sObjectTag, nImpulseX, nImpulseY, nImpulseZ ) 
"Applies torque impulse to the selected object"
bOK = applyBodyLinearImpulse (sObjectTag, nImpulseX, nImpulseY, nImpulseZ, nPosX, nPosY, nPosZ ) 
"Applies a linear impulse to the selected object at relative position (nPosX, nPosY, nPosZ) of the object. If nPos values are not specified, the impulse is at the centre of mass\n ) "
bOK = setBodyDamping (sObjectTag, nLinearDamping, nAngularDamping ) 
"Sets the linear and angular damping values to be used for this object when applyBodyDamping is activated"
bOK = translateBody (sObjectTag, nPosX, nPosY, nPosZ ) 
"Translates the Rigid Body and it's object to location (nPosX, nPosY, nPosZ) ) "
nConstraintID = addPivot (sObjectTagA, nPivotXA, nPivotYA, nPivotZA, sObjectTagB, nPivotXB, nPivotYB, nPivotZB ) 
"Adds a pivot constraint to ObjectA and optionally ObjectB at the nominated pivot points. Objects must previously have had rigid bodies assigned to them."
nResult = createBody (sObjectTag, nMass, sCollisionShape ) 
"Creates a new physics body using a previously created collision shape.\nThe collision shape name should match the object tag of the originally created body"
bOK = createCapsule (sObjectTag, nMass, nRadius, nHeight, kBodyAxis ) 
"Creates a default rigid body capsule with a mass nMass and a radius of nRadius, height of nHeight and attaches it to object sObjectTag"
bOK = createCylinder (sObjectTag, nMass, nExtentX, nExtentY, nExtentZ, kBodyAxis ) 
"Creates a default rigid body cylinder with a mass nMass and dimensions of the extents, aligned to kBodyAxis and attaches it to object sObjectTag"
bOK = createBox2D (sObjectTag, nMass, nExtentX, nExtentY ) 
"Creates a rigid body 2D Box with a mass nMass and dimensions of the extents,  and attaches it to object sObjectTag"
bOK = createTriangle (sObjectTag, nMass, p1X, p1Y, p1Z, p2X, p2Y, p2Z, p3X, p3Y, p3Z ) 
"Creates an rigid body Triangle with the 3 provided points, and attaches it to object sObjectTag"
bOK = createStaticPlane (sObjectTag, nNormalX, nNormalY, nNormalZ, nPlaneConstant ) 
"Creates an infinite static rigid body Plane with the given normal vector and plane constant, and attaches it to object sObjectTag"
bOK = createConvexHull (sObjectTag, nMass ) 
"Creates a Convex Hull shell, attached to the given object. Hull points must be setup with the addCHPoint function"
bOK = addCHPoint (sObjectTag, pX, pY, pZ ) 
"Adds a point to the Convex Hull rigid body attached to the tagged object."
bOK = createCone (sObjectTag, nMass, nRadius, nHeight, kBodyAxis ) 
"Creates a default rigid body cone with a mass nMass and a radius of nRadius, height of nHeight and attaches it to object sObjectTag"
nX, nY, nZ = getGravity ( ) 
"Returns the gravity vector of the current world"
bOK = setSleepingThresholds (sObjectTag, nLinearThreshold, nAngularThreshold ) 
"Sets the individual idle thresholds for linear and angular velocity for the given body. Linear is in m/sec and angular is in rad/sec"
bOK = setGravity (nGravity ) 
"Sets the world gravity in the Y axis"
bOK = createSphere (sObjectTag, nMass, nRadius ) 
"Creates a default rigid body sphere with a mass nMass and a radius of nradius, and attaches it to object sObjectTag"
bOK = createBox (sObjectTag, nMass, nSx, nSy, nSz ) 
"Creates a default rigid body box with a mass nMass and size <nSx, nSy, nSz> and attaches it to object sObjectTag"
bOK = stepWorld (nStepTime ) 
"Steps the current physics world simulation by the step time specified"
nWorldID = createWorld (kType, nGravity, nCollisionConfig, nBroadphase, nSolver ) 
"Initialises a new world of kType. \nThe individual components can be setup beforehand and passed in to configure the world.\nIf a parameter is not relevent to a specific world type, it will be ignored.\nIf an option is not set, it will use default values"
bOK = deleteWorld (nWorldID ) 
"Destroys the specific physics world and all elements within that world."
 
*** Constants ***
 
k2DCustom = 5
"Defines a custom 2D shape. sbPhysics will attempt to match all the points with a Z-Axis of 0"
k2DCircle = 1
"Defines a 2D Circle shape"
k2DTriangle = 2
"Defines a 2D Triangle shape"
k2DStar = 3
"Defines a 2D Star shape, Radius nP1, with number of arms nP2"
k2DHexagon = 4
"Defines a 2D Hexagon shape for the given radius"
k2DWorld = 5
"Identifies a world optimised for using 2D bodies. Note the collision configuration, dispatcher, solvers and broadphase will all be ignored for a 2D world"
kBodyAxisX = 0
"Alignment on the X axis for rigid bodies axis aligned"
kBodyAxisY = 1
"Alignment on the Y axis for rigid bodies axis aligned"
kBodyAxisZ = 2
"Alignment on the Z axis for rigid bodies axis aligned"
kDefaultCollisionConfig = 1
"Defines default collision configuration type"
kSoftBodyCollisionConfig = 2
"Defines softbody collision configuration on top of default collision configuration type"
kDefaultDispatcher = 1
"Defines the default collision dispatcher"
kDbvtBroadphase = 1
"Defines a broadphase using two dynamic AABB bounding volume hierarchies/trees"
kAxisSweep3Broadphase = 2
"Defines a 3d axis sweep and prune broadphase"
kSequentialImpulseConstraintSolver = 1
"Defines the Squential Impulse Constraint solver"
kDefaultSolver = 1
"Defines the default contraint solver as the SequentialImpulseConstraintSolver"
kDefaultBroadphase = 1
"Defines a default broadphase as the kDbvtBroadphase"
kDefaultGravity = -9.8f
"Defines the default gravity of -9.8 m/s in the Y axis"
kCollisionWorld = 1
"Identifies a world with just collision detection"
kDiscreteRigidWorld = 2
"Identifies a world with collision detection and rigid bodies"
kContinuousRigidWorld = 3
"Identifies an expanded Rigid world with optional continuous collision detection for fast moving bodies"
kSoftBodyWorld = 4
"Identifies a world with collisions, discrete rigid bodies and soft bodies"