The physics system used in fluxus is based on the ode library, which allows you to add physical properties to objects and set them in motion. Since ODE is designed for rigid-body simulations, structures are described in terms of objects, joints and forces. A much more comprehensive explanation of these concepts can be found in the ODE documentation, which you have probably downloaded if you have compiled fluxus, or can be found at http://ode.org/ode-docs.html To help with debugging joints, try calling (render-physics) every frame, which will render locators showing you positions and axes of joints that have positional information.
void
Enables or disables collision detection. Defaults to off.
(collisions 1)
void
Create an infinite passive plane for use as the 'ground'
(ground-plane (vector 0 1 0) 0)
void
Enable the object to be acted upon by the physics system, using a box as the bounding volume. As an active object, it will be transformed by ode. Note: rotations only work correctly if you specify your transforms scale first, then rotate (translate doesn't matter) basically, ode can't deal with shearing transforms.
(define mycube (build-cube)) (active-box mycube)
void
Enable the object to be acted upon by the physics system, using a cylinder as the bounding volume. As an active object, it will be transformed by ode. Note: rotations only work correctly if you specify your transforms scale first, then rotate (translate doesn't matter) basically, ode can't deal with shearing transforms.
(define mycube (build-cube)) (active-cylinder mycube)
void
Enable the object to be acted upon by the physics system, using a sphere as the bounding volume. As an active object, it will be transformed by ode. Note: rotations only work correctly if you specify your transforms scale first, then rotate (translate doesn't matter) basically, ode can't deal with shearing transforms.
(define mycube (build-cube)) (active-sphere mycube)
void
Enable the object to be acted upon by the physics system, using a sphere as the bounding volume. As a passive object, active objects will collide with it, but it will not be transformed. Note: rotations only work correctly if you specify your transforms scale first, then rotate (translate doesn't matter) basically, ode can't deal with shearing transforms.
(define mycube (build-cube)) (passive-box mycube)
void
Enable the object to be acted upon by the physics system, using a cylinder as the bounding volume. As a passive object, active objects will collide with it, but it will not be transformed. Note: rotations only work correctly if you specify your transforms scale first, then rotate (translate doesn't matter) basically, ode can't deal with shearing transforms.
(define mycube (build-cube)) (passive-cylinder mycube)
void
Enable the object to be acted upon by the physics system, using a sphere as the bounding volume. As a passive object, active objects will collide with it, but it will not be transformed. Note: rotations only work correctly if you specify your transforms scale first, then rotate (translate doesn't matter) basically, ode can't deal with shearing transforms.
(define mycube (build-cube)) (passive-sphere mycube)
void
Sets some global surface attributes that affect friction and bouncyness. see section 7.3.7 of the ODE docs for an explanation of these parameters
(surface-params 0.1 0.1 0.1 0.1)
void
Creates a balljoint to connect two objects (see the ode docs for a detailed description of the differences between the joint types). ODE considers joints to be a constraint that is enforced between two objects. When creating a joint, it is important to have the two primitives being joined in the desired positions before creating the joint. Joints can be created, modified and indexed in a similar way to other primitives.
(build-balljoint shape1 shape2 (vector 0 1 0))
void
Creates a joint to connect an object to the global environment. This locks the object in place.
(build-fixedjoint shape)
hingeid-number
Creates a ball joint to connect two objects (see the ode docs for a detailed description of the differences between the joint types). ODE considers joints to be a constraint that is enforced between two objects. When creating a joint, it is important to have the two primitives being joined in the desired positions before creating the joint. Joints can be created, modified and indexed in a similar way to other primitives.
(build-hingejoint shape1 shape2 (vector 0 1 0) (vector 0 1 0))
hingeid-number
Creates a slider joint to connect two objects (see the ode docs for a detailed description of the differences between the joint types). ODE considers joints to be a constraint that is enforced between two objects. When creating a joint, it is important to have the two primitives being joined in the desired positions before creating the joint. Joints can be created, modified and indexed in a similar way to other primitives.
(build-sliderjoint shape1 shape2 (vector 0 1 0))
hingeid-number
Creates a hinge2 joint to connect two objects (see the ode docs for a detailed description of the differences between the joint types). ODE considers joints to be a constraint that is enforced between two objects. When creating a joint, it is important to have the two primitives being joined in the desired positions before creating the joint. Joints can be created, modified and indexed in a similar way to other primitives.
(build-hinge2joint shape1 shape2 (vector 0 100 0) (vector 0 1 0) (vector 0 1 0))
hingeid-number
Creates a angular motor joint to connect two objects (see the ode docs for a detailed description of the differences between the joint types). ODE considers joints to be a constraint that is enforced between two objects. When creating a joint, it is important to have the two primitives being joined in the desired positions before creating the joint. Joints can be created, modified and indexed in a similar way to other primitives.
(build-amotorjoint shape1 shape2 (vector 0 1 0))
hingeid-number
Sets the joint parameter for a joint where param is one of the following: "HiStop", "Vel", "FMax", "FudgeFactor", "Bounce", "CFM", "StopERP", "StopCFM","SuspensionERP", "SuspensionCFM", "Vel2", "FMax2". see section 7.5.1 of the ODE docs for an explanation of each of these parameters, and which joint types they apply to.
(joint-param joint "Vel" 0.1)
void
Set a new angle for this joint, with a given velocity taken to get there
(joint-angle joint "Vel" 0.1)
void
Sets the maximum number of objects the physics system can deal with. When the max level has been reached the oldest objects are automatically destroyed.
(set-max-physical 100)
void
Sets the mass of an active object
(set-mass myshape 100)
void
Sets the strength and direction of gravity.
(gravity (vector 0 -1 0))
void
Applies translation force to the object
(kick myshape (vector 0 1 0))
void
Applies rotational force to the object
(kick myshape (vector 2 0 0))
void
Returns true if the grabbed object collided in the last frame
(if (has-collided myshape) (display "bang!"))