|
|
jsode
jsode module
jsode module
jsode is a module that manages support to ODE. ODE is an open source, high performance library for simulating rigid body dynamics. It is fully featured, stable, mature and platform independent with an easy to use C/C++ API. It has advanced joint types and integrated collision detection with friction. ODE is useful for simulating vehicles, objects in virtual reality environments and virtual creatures. It is currently used in many computer games, 3D authoring tools and simulation tools.note:
In the following API description, vec3 type is a js 3 dimentions array like [1, 3,5, 0]
jsode::World class
Functions
- Constructor()
dWorldCreatenote:
This function creates also a Space (space) object and a SurfaceParameters object (defaultSurfaceParameters).
- Step( time [, iterations] )
note:
If the iterations argument is given, this uses an iterative method that takes time on the order of m*N and memory on the order of m, where m is the total number of constraint rows and N is the number of iterations.
- Destroy()
Properties
- vec3 gravity
- Body object env
Returns the environment object that is the fixed body of this world (like the ground).
- real ERP
dWorldGetERP
- real CFM
dWorldGetCFM
- real contactSurfaceLayer
dWorldGetContactSurfaceLayer
- defaultSurfaceParameters
This defines the default properties of the colliding grometries surfaces.The property is read-only but not i'ts content.
- space
This is the default space object that is bound to the world.
jsode::Body class
Functions
- Constructor( world )
- Destroy()
dBodyDestroy
- bool IsConnectedTo( body )
dAreConnected
Properties
- vec3 position
dBodySetPosition
- vec4 quaternion
dBodySetQuaternion
- vec3 linearVel
dBodySetLinearVel
- vec3 angularVel
dBodySetAngularVel
- vec3 force
dBodySetForce
- vec3 torque
dBodySetTorque
- mass
Is the mass object (jsode::Mass) of the body.
note:
This class exports a NI_READ_MATRIX44 interface to read the current body's position.
jsode::Mass class
Functions
- Translate( vec3 )
dMassTranslate + dBodySetMass
- Adjust( mass )
dBodyGetMass, dMassAdjust, dBodySetMass
- SetZero()
dBodyGetMass, dMassSetZero, dBodySetMass
- SetBoxTotal( mass, vec3 )
dBodyGetMass, dMassSetBoxTotal, dBodySetMass
Properties
- value
dBodyGetMass, dBodySetMass
- center
dBodyGetMass, dBodySetMass get/set a vec3
jsode::SurfaceParameters class
Functions
- Constructor()
note:
by default, mu is set to Infinity.
Properties
- real mu
- real mu2
- real bounce
- real bounceVel
- real softERP
- real softCFM
- real motion1
- real motion2
- real slip1
- real slip2
note:
Use <undefined> as value to reset the property.
jsode::Space class
Functions
- Constructor( parentSpace )
jsode::Joint class
Functions
- Destroy()
Properties
- body1
Set the first body of the joint.
- body2
Set the second body of the joint.
- real loStop
- real hiStop
- real bounce
- real CFM
- real stopERP
- real stopCFM
- real velocity
- real maxForce
- useFeedback
Set to <true> activates the feedback, and <false> to desactivates it.Using feedback will allows body1Force, body1Torque, body2Force and body2Torque to be used.
- vec3 body1Force
Is the current force vector that applies to the body1 if feedback is activated.
- vec3 body1Torque
Is the current torque vector that applies to the body1 if feedback is activated.
- vec3 body2Force
Is the current force vector that applies to the body2 if feedback is activated.
- vec3 body2Torque
Is the current torque vector that applies to the body2 if feedback is activated.
jsode::JointBall class jsode::Joint
Functions
- Constructor( world )
Properties
- vec3 anchor
- vec3 anchor2
jsode::JointHinge class jsode::Joint
Functions
- Constructor( world )
Properties
- vec3 anchor
- vec3 anchor2
- vec3 axis
Get or set the axis of the joint.
- real angle
Get the current angle.
- real angleRate
Get the current rotation speed.
jsode::JointSlider class jsode::Joint
Functions
- Constructor( world )
Properties
- vec3 axis
- real position
- real positionRate
jsode::JointFixed class jsode::Joint
Functions
- Constructor( world )
- Set()
Set the current position of body1 and body2 as fixed.
jsode::JointPlane class jsode::Joint
Functions
- Constructor( world )
jsode::Geom class
Functions
- Destroy()
dGeomSetData NULL, dGeomDestroy
Properties
- body body
Bind the current geometry to the given body object.
- tansformation
Sets the position and rotation of the geometry to its center of mass.
- offset
Sets the position and rotation of the geometry to its center of mass.Use <undefined> value to reset the geometry offset.
- bool enable
Is the status of the geometry.
- vec3 position
Is the current position of the geometry.
Callback functions
- impact(index, thisGeom, againstGeom, position);
This function is called each time two geometries collide together. index is the index of the collision between step and step+1.thisGeom is the geometry that is colliding (usualy, this object).
againstGeom is the geometry against with this geometry is colliding (the other Geom).
vec3 position is the position of the impact point in world position.
note:
This class exports a NI_READ_MATRIX44 interface to read the current body's position.
jsode::GeomSphere class jsode::Geom
Functions
- Constructor( space )
Properties
- real radius
jsode::GeomBox class jsode::Geom
Functions
- Constructor( space )
Properties
- vec3 lengths
Is the x, y, z size of the box.
jsode::GeomPlane class jsode::Geom
Functions
- Constructor( space )
jsode::GeomCapsule class jsode::Geom
Functions
- Constructor( space )
Properties
- real radius
- real length
Is the length of the capsule.
jsode::GeomRay class jsode::Geom
Functions
- Constructor( space )
Properties
- vec3 start
- vec3 direction
- real length
Sign in to add a comment
