GM_ODE is Copyright © 2004 by Steffen Itterheim
GM_ODE: Recommendations & More
First, I’d like to point you to the ODE documentation. I will refer to it a lot. I only add what is not in the documentation or not clear enough. ODE Documentation
In the ODE Documentation you will stumble across this section for „Typical simulation code“:
In GM_ODE this is the same, although some parts are done internally by the DLL, some are tasks of the ODE object (you can modify its behavior if need be) and the rest is left up to you.
Use ODE_CreateWorld() script or:
external_call(ODE.WorldCreate, window_handle())
Use ODE_CreateBody() script or:
external_call(ODE.BodyCreate, x, y, z, instance_id);
Use ODE_CreateJoint() script or:
external_call(ODE.JointCreate***, 0)
external_call(ODE.JointAttach, joint_id, body1_id, body2_id)
Use any of the numerous joint parameter functions. There are two groups, one group of functions works only on the specific joint type (class), the other group sets parameters common to all joints.
For example JointSetHingeAxis works only for hinge joints whereas JointSetParamBounce works for all types of joints.
By calling ODE_CreateWorld() or WorldCreate you already have a global collision space (id == 0). Geometry objects are already assigned to bodies when you use ODE_CreateBody() script.
This is done for you internally when you call ODE_CreateWorld or WorldCreate.
This is your part!
This is also your part!
Collision detection is handled by the ODE object in every step event. It will call the „standard“ SpaceCollide function used in most of the ODE examples.
This is done for you internally in the DLL.
Again this is a job for the ODE object in the step event. By default it will call WorldQuickStep.
And once again this is done in the ODE object, but this time in the Step Begin event. Why? Because when you get to do stuff in the Step End event of your objects the contact joints should still be there. That way you can determine wether an object has collided or not.
Note: if external_call(WorldClearContactJoints) would not be called every step the simulation would quickly slow down!
Done automatically when the ODE object is destroyed.
Start simple! Do not go for Angular Motors and composite objects if you haven’t mastered spheres and hinge joints yet!
In 2D games, stick to sphere and box geoms and use only hinge joints. All other geoms/joints either behave almost the same or do not make (much) sense without a third dimension. They may even behave erroneously if you set their parameters incorrectly, or not at all. Feel free to experiment though.
Get a feel for the parameters. Only change one parameter at a time. Get to know the parameter limits and value ranges by reading the ODE documentation.
Some values may go from 0 to Infinity. Some may go from –PI to +PI. Others may go from 0 to 1. Some of these might have their effective range from 0 to 0.00001 - CFM is a good example, it already has an enormous effect if set to 0.00001 compared to just plain 0!
Use GM_ODE.GMD either as a starting point for your own projects, or create a new project or open an existing one and use the „File -> Merge Game“ function in Game Maker to include GM_ODE to your project.
There are 4 DLLs in the SDK. I recommend using the Single precision DLL in Debug mode for developing and the Single Release DLL when you release your game.
Single or Double determines the precision of the DLL. Single is just fine for games but if you want somewhat better accuracy in favor of execution speed use the Double DLL. I suppose in most cases you won’t notice the difference at all. For C/C++ programmers: Single DLL uses „float“ (4 Bytes) whereas Double DLL uses „double“ (8 Bytes) for all real values.
Debug or Release determines wether the DLL will give you assertion failed messages if something goes wrong (Debug) or simply crash (Release). However, the Release DLL is somewhat faster as the compiled code is optimized for speed. I noticed that the performance gain is only between 5-20% when using the Release DLL, so use the Debug DLL for developing and when you release your game replace the DLL with the Release DLL.
About Version numbers …
GM_ODE will maintain the same version number as ODE. For example, if the current ODE version linked to the GM_ODE DLL is v0.5 then GM_ODE will also be v0.5. If there is an update to ODE and it will be linked with the GM_ODE DLL the ODE version number will also be changed accordingly.
Since there will be updates to GM_ODE in between new versions of ODE i will refer to these update versions as „Build Numbers“. It will read like this: „GM_ODE v0.5.71“ – the number after the second dot is the build version of the DLL which gets increased every time i perform a build of the GM_ODE DLL.
If you experience frequent „Unexpected Error Occured when running the game“ then this is Game Maker saying that the DLL has crashed (caused an exception). Ok, Game Maker does say so in other cases as well, but the chances are high that it is caused by the DLL. So in general there are mainly two reasons for this error to occur: a user error, for example calling a function with an improper id (body, joint, geom, etc), or a DLL internal error. In this case it might be a bug in the DLL or even ODE but it can also be due to memory running out. If you notice this type of error when the number of objects (bodies, geoms, joints, etc.) increases in your game then it is most likely that ODE is running out of internal (stack) memory. There’s hardly anything i can do about that. You will get this error a lot earlier though when you use WorldStep instead of WorldQuickStep, so switching to Quickstep (the default) might help. In general, reduce the amount of objects you use.
If you get this error with only few objects, make sure you use the Debug DLL. I tried to assert most of what you can do wrong as a user, so if you get an assertion failed message it is most likely your fault (sorry to say so). If you still get the „unexpected error“ message even when using the Debug DLL and only few objects let me know about it, it might be a bug in the DLL.
One bit of a warning: yes, i suppose things like motors and everything else should work, at least i don't see any reason why it shouldn't. However, it is quite tedious to get all the parameters right and to gain an understanding of how things work, so i recommend to start simple!
It is also difficult to debug things, because you can't "see" the bodies, joints and geoms. Moreover without the "third" dimension some things might behave differently. Well, you have all the values at hand, but displaying them in a manner that helps you debug some strange behavior in your code is left up to you. As i said, it can get tedious tweaking the parameters and debugging what is going on.
At least i provided you with a Log to file and ASSERT scripts that came in handy when i made the DLL. In fact, they've been with me a loooong time and i wouldn't want to miss these two, so feel free to use (rip) them even if you don't use GM_ODE.
Also. there are many functions i haven't tested - there are just too many. They are not really complicated but there might be a copy & paste error somewhere. If you get strange results let me know (i prefer forum messages rather than PM if it is of general interest).
The bad thing is, some strange results are indeed valid results from ODE - but you can't know that. Not even i know that. For example the joint feedback forces highly fluctuate every step and i am not sure if that is correct, although there is some correlation of the average force values over a couple steps with the actual strain of (or forces applied to) the joint.
Log(message, filename)
// log message to a file
// arg0 = message
// arg1 = filename
ASSERT(expression, message)
// shows assertion failed message, can either be ignored or used to end game
// also logs error to file
// arg0 = expression (if expression is false the message pops up)
// arg1 = message
ODE_CreateWorld()
// Initialize ODE DLL
// creates the ODE object and initializes it
// creates an ODE World
// creates a global space (space_id = 0)
// creates a default joint group
// return instance_id of ODE object
// Note: this script should/can only be called ONCE per room!
ODE_CreateBody(dGeomType, x, y, object, mass, p1, p2, p3, p4)
// creates an instance of an object representing the body
// creates a new body
// creates a new geom (depending on geom type)
// assign the geom to the body
// creates a new mass (if geom type is appropriate, otherwise ignored)
// set the mass of the body
// set local vars in instance for further reference:
// body_id, mass_id, geom_id[..]
// the parameters 1-4 (argument5-8) are:
// for box geom: length of sides x, y, z
// for sphere geom: radius
// for cylinder geom: radius, length
// for ray geom: length
// for plane geom: a, b, c, d (plane normal vector)
// return instance_id of new instance
// NOTE: function has only been tested with box and sphere geoms!
// The valid geom types are as follows:
// ODE.dSphereClass
// ODE.dBoxClass
// ODE.dCCylinderClass
// ODE.dPlaneClass
// ODE.dRayClass
ODE_DestroyBody(body_id)
// arg0 = body_id
// this destroys the body and the geoms assigned to the body
// you should always call this when the instance representing this body is about to be destroyed
ODE_CreateJoint(dJointType, body1_id, body2_id)
// creates a joint and attaches the two bodies with it
// either arg1 or arg2 can be 0 to attach this end of the joint to the world
// arg0 = type of joint (e.g. ODE.dJointTypeHinge)
// arg1 = body1_id (body id of first body to connect joint with)
// arg2 = body2_id or 0 (body id of second body to connect joint with)
// return joint_id
ODE_CreateCollisionRoomBorder()
// create 4 box geoms at the borders of the room,
// so objects can collide with the room borders
// however, at very high speeds objects may still penetrate the
// border boxes and leave the room!
ODE
This is the ODE object itself. It is created when you call ODE_CreateWorld().
If you do not (want to) use ODE_CreateWorld() you must create exactly one instance of the ODE object in your room before you can call any of the GM_ODE DLL functions. Creating an instance of the ODE object also initializes the DLL functions.
There are quite a lot of variables in the ODE object that you should know of:
To access any of these variables, prefix it with „ODE.“ … this is the standard way in GM to access local variables of an object, and since there can only be one ODE object per room it is safe.
For example use:
ODE.bOnly2Dmotion = false
From any other object’s script to allow full 3D motion of objects.
// wether to use quickstep or normal step function
// it is not recommended to set it to false, the normal worldstep
// function may be more accurate but it also consumes much more
// memory and CPU time
// if you want to use normal step function do NOT change this value here
// instead set ODE.bUseQuickStep = false in another object’s script
bUseQuickStep = true
// if you want to use full 3D motion do NOT change this value here
// instead set ODE.bOnly2DMotion = false in another object’s script
bOnly2DMotion = true
// id of default joint group, always 0
DefaultJointGroup = 0
// DLL internal joint types ... DO NOT CHANGE THESE VALUES!
dJointTypeNone = 0
dJointTypeBall = 1
dJointTypeHinge = 2
dJointTypeSlider = 3
dJointTypeContact = 4
dJointTypeUniversal = 5
dJointTypeHinge2 = 6
dJointTypeFixed = 7
dJointTypeNull = 8
dJointTypeAMotor = 9
// DLL internal contact mode bits ... DO NOT CHANGE THESE VALUES!
dContactModeBitMu2 = 1
dContactModeBitFDir1 = 2
dContactModeBitBounce = 4
dContactModeBitSoftERP = 8
dContactModeBitSoftCFM = 16
dContactModeBitMotion1 = 32
dContactModeBitMotion2 = 64
dContactModeBitSlip1 = 128
dContactModeBitSlip2 = 256
dContactModeBitApprox0 = 0
dContactModeBitApprox1_1= 4096
dContactModeBitApprox1_2= 8192
dContactModeBitApprox1 = 12288
// DLL internal geom class types ... DO NOT CHANGE THESE VALUES!
dSphereClass = 0
dBoxClass = 1
dCCylinderClass = 2
dCylinderClass = 3
dPlaneClass = 4
dRayClass = 5
dGeomTransformClass = 6
dTriMeshClass = 7
dSimpleSpaceClass = 8
dHashSpaceClass = 9
dQuadTreeSpaceClass = 10
// DLL internal motor types ... DO NOT CHANGE THESE VALUES!
dAMotorUser = 0
dAMotorEuler = 1
// some functions will interpret this as „infinity“, it is not the same
// as ODE’s dInfinity constant, so only use this for functions that use
// -1 as synonym for „infinity“
Infinity = -1
// DLL upper limits, DO NOT CHANGE .. these are hardcoded in the DLL:
MAX_BODIES = 1024
MAX_SPACES = 1024
MAX_GEOMS = 4096
MAX_JOINT_GROUPS = 1024
MAX_JOINTS = 2048
MAX_JOINT_FEEDBACKS = 1024
MAX_CONTACTS = 16
// these can be increased if necessary, determines the array sizes of
// ODE_Body arrays geom_id and joint_id
MAX_GEOMS_PER_BODY = 64
MAX_JOINTS_PER_BODY = 16
// just some object counters
// they are not really used persistently or for anything else other than
// displaying the number of objects created…
NumBodies = 0
NumSpaces = 0
NumGeoms = 0
NumJointGroups = 0
NumJoints = 0
ODE_Body
This is a parent object for all your objects which should become „bodies“. Simply set ODE_Body as the parent of your own body object.
If you override the Create or End Step events of your body make sure that you call
event_inherited()
before you begin with your own code.
The ODE_Body Create event will simply initialize local variables like body_id, mass_id, joint_id and geom_id. It is recommended, although not necessary, to use these variables as local storage for this object’s body_id, mass_id, joint_ids (array) and geom_ids (array). You will probably need at least one of these later on!
The ODE_Body End Step event will update ist position (x,y) and direction.
Note that it is not necessary to use ODE_Body as parent object, however it is quite convenient to do so. J
// see ODE_DLL_Documentation script for further information ...
// use: create a new body for a specific instance
// params: x, y, z, instance_id of object instance representing this body
// return: body_id
BodyCreate = external_define("gm_ode.dll", "ODE_BodyCreate", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
// use: destroy a body, destroying all joints and geoms attached to it
// params: body_id (as returned from BodyCreate)
// return: always true
BodyDestroy = external_define("gm_ode.dll", "ODE_BodyDestroy", dll_cdecl, ty_real, 1, ty_real)
// use: enable or disable a body (disabled bodies do not react to forces or collision thus saving CPU time)
// params: body_id (as returned from BodyCreate)
// return: always true
BodyEnable = external_define("gm_ode.dll", "ODE_BodyEnable", dll_cdecl, ty_real, 1, ty_real)
BodyDisable = external_define("gm_ode.dll", "ODE_BodyDisable", dll_cdecl, ty_real, 1, ty_real)
// use: checks if a body is enabled
// params: body_id (as returned from BodyCreate)
// return: true if body is currently enabled, false if body is currently disabled
BodyIsEnabled = external_define("gm_ode.dll", "ODE_BodyIsEnabled", dll_cdecl, ty_real, 1, ty_real)
// use: get the game maker instance_id representing the body with the given body_id
// params: body_id (as returned from BodyCreate)
// return: instance id of this body
BodyGetInstanceId = external_define("gm_ode.dll", "ODE_BodyGetInstanceId", dll_cdecl, ty_real, 1, ty_real)
// use: set position of the body, this will also set the position of the instance connected with this body,
// provided that you call the default ODE_Body_Step_End_Event script
// params: body_id, x, y, z
// return: instance id of this body
BodySetPosition = external_define("gm_ode.dll", "ODE_BodySetPosition", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
// use: get the x, y, z component of the body's position
// params: body_id
// return: x, y, z respectively
BodyGetPositionX = external_define("gm_ode.dll", "ODE_BodyGetPositionX", dll_cdecl, ty_real, 1, ty_real)
BodyGetPositionY = external_define("gm_ode.dll", "ODE_BodyGetPositionY", dll_cdecl, ty_real, 1, ty_real)
BodyGetPositionZ = external_define("gm_ode.dll", "ODE_BodyGetPositionZ", dll_cdecl, ty_real, 1, ty_real)
// use: set/get rotation matrix of a Body
// params: body_id, 11, 22, 33, 12, 13, 23 (elements of rotation matrix)
// return: elements of rotation matrix
BodySetRotationMatrix = external_define("gm_ode.dll", "ODE_BodySetRotationMatrix", dll_cdecl, ty_real, 7, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
BodyGetRotationMatrix11 = external_define("gm_ode.dll", "ODE_BodyGetRotationMatrix11", dll_cdecl, ty_real, 1, ty_real)
BodyGetRotationMatrix12 = external_define("gm_ode.dll", "ODE_BodyGetRotationMatrix12", dll_cdecl, ty_real, 1, ty_real)
BodyGetRotationMatrix13 = external_define("gm_ode.dll", "ODE_BodyGetRotationMatrix13", dll_cdecl, ty_real, 1, ty_real)
BodyGetRotationMatrix22 = external_define("gm_ode.dll", "ODE_BodyGetRotationMatrix22", dll_cdecl, ty_real, 1, ty_real)
BodyGetRotationMatrix23 = external_define("gm_ode.dll", "ODE_BodyGetRotationMatrix23", dll_cdecl, ty_real, 1, ty_real)
BodyGetRotationMatrix33 = external_define("gm_ode.dll", "ODE_BodyGetRotationMatrix33", dll_cdecl, ty_real, 1, ty_real)
// use: set the body's direction (orientation around Z axis)
// params: body_id, direction (in degrees, 0-360)
// return: always true
BodySetDirection = external_define("gm_ode.dll", "ODE_BodySetDirection", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: clear the body's direction (orientation), that means calling this every step makes the body stop rotating
// useful for all objects which shouldn't rotate, for example monsters or bricks
// although the sprite won't rotate without calling this function the body itself (which you can't see) might
// rotate leading to undesired collision behavior
// params: body_id
// return: always true
BodyClearDirection = external_define("gm_ode.dll", "ODE_BodyClearDirection", dll_cdecl, ty_real, 1, ty_real)
// use: get the body's direction (orientation)
// params: body_id
// return: direction in degrees (0-360)
BodyGetDirection = external_define("gm_ode.dll", "ODE_BodyGetDirection", dll_cdecl, ty_real, 1, ty_real)
// use: set/get linear velocity of body (setting velocity on body directly is not recommended! use set/add force/torque instead!)
// params: body_id, x, y, z (components of velocity vector
// return: x, y, z component of velocity vector, respectively
BodySetLinearVelocity = external_define("gm_ode.dll", "ODE_BodySetLinearVelocity", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
BodyGetLinearVelocityX = external_define("gm_ode.dll", "ODE_BodyGetLinearVelocityX", dll_cdecl, ty_real, 1, ty_real)
BodyGetLinearVelocityY = external_define("gm_ode.dll", "ODE_BodyGetLinearVelocityY", dll_cdecl, ty_real, 1, ty_real)
BodyGetLinearVelocityZ = external_define("gm_ode.dll", "ODE_BodyGetLinearVelocityZ", dll_cdecl, ty_real, 1, ty_real)
// use: set/get Angular velocity of body (setting velocity on body directly is not recommended! use set/add force/torque instead!)
// params: body_id, x, y, z (components of velocity vector
// return: x, y, z component of velocity vector, respectively
BodySetAngularVelocity = external_define("gm_ode.dll", "ODE_BodySetAngularVelocity", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
BodyGetAngularVelocityX = external_define("gm_ode.dll", "ODE_BodyGetAngularVelocityX", dll_cdecl, ty_real, 1, ty_real)
BodyGetAngularVelocityY = external_define("gm_ode.dll", "ODE_BodyGetAngularVelocityY", dll_cdecl, ty_real, 1, ty_real)
BodyGetAngularVelocityZ = external_define("gm_ode.dll", "ODE_BodyGetAngularVelocityZ", dll_cdecl, ty_real, 1, ty_real)
// use: set/get the body's mass
// get mass may return a different mass_id than the one previously assigned to the body
// it just returns the mass_id whose parameters correspond to the body's mass
// it may return -1 if no mass was found that is exactly like the body's mass, in that case create a new mass
// also note that masses and bodies are not connected! if you set a mass to a body, then change
// the mass the body's mass will not change before you set the mass with BodySetMass again!
// params: body_id, mass_id
// return: mass_id
BodySetMass = external_define("gm_ode.dll", "ODE_BodySetMass", dll_cdecl, ty_real, 2, ty_real, ty_real)
BodyGetMass = external_define("gm_ode.dll", "ODE_BodyGetMass", dll_cdecl, ty_real, 1, ty_real)
// use: set or add a force on the body, setting the force means only the set force acts on the body
// params: body_id, x, y, z (== components of direction vector, use lengthdir_* to obtain the vector)
// for example, to add a force to the object in direction to the mouse cursor use the following script:
/*
var dist, dir, lx, ly;
dist = point_distance(x, y, mouse_x, mouse_y)
dir = point_direction(x, y, mouse_x, mouse_y)
lx = lengthdir_x(dist, dir)
ly = lengthdir_y(dist, dir)
external_call(ODE.BodyAddForce, body_id, lx, ly, 0)
*/
// return: always true
BodySetForce = external_define("gm_ode.dll", "ODE_BodySetForce", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
BodyGetForceX = external_define("gm_ode.dll", "ODE_BodyGetForceX", dll_cdecl, ty_real, 1, ty_real)
BodyGetForceY = external_define("gm_ode.dll", "ODE_BodyGetForceY", dll_cdecl, ty_real, 1, ty_real)
BodyGetForceZ = external_define("gm_ode.dll", "ODE_BodyGetForceZ", dll_cdecl, ty_real, 1, ty_real)
BodyAddForce = external_define("gm_ode.dll", "ODE_BodyAddForce", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
// FIXME: functions to set/add forces by direction alone
// use: set or add a (relative) force on a (relative) position in the body
// you can apply a force in the relative direction of the body, at a relative position (instead of global position) in the body
// params: body_id, x, y, z (direction vector, see above), px, py, pz (position)
// return: always true
BodyAddRelativeForce = external_define("gm_ode.dll", "ODE_BodyAddRelativeForce", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
BodyAddForceAtPosition = external_define("gm_ode.dll", "ODE_BodyAddForceAtPosition", dll_cdecl, ty_real, 7, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
BodyAddRelativeForceAtPosition = external_define("gm_ode.dll", "ODE_BodyAddRelativeForceAtPosition", dll_cdecl, ty_real, 7, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
BodyAddForceAtRelativePosition = external_define("gm_ode.dll", "ODE_BodyAddForceAtRelativePosition", dll_cdecl, ty_real, 7, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
BodyAddRelativeForceAtRelativePosition = external_define("gm_ode.dll", "ODE_BodyAddRelativeForceAtRelativePosition", dll_cdecl, ty_real, 7, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
// use: set or add a (relative) torque on the body, torque is a rotational force (spinning wheel of a car)
// params: body_id, x, y, z (direction vector, see above)
// return: always true
BodySetTorque = external_define("gm_ode.dll", "ODE_BodySetTorque", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
BodyGetTorqueX = external_define("gm_ode.dll", "ODE_BodyGetTorqueX", dll_cdecl, ty_real, 1, ty_real)
BodyGetTorqueY = external_define("gm_ode.dll", "ODE_BodyGetTorqueY", dll_cdecl, ty_real, 1, ty_real)
BodyGetTorqueZ = external_define("gm_ode.dll", "ODE_BodyGetTorqueZ", dll_cdecl, ty_real, 1, ty_real)
BodyAddTorque = external_define("gm_ode.dll", "ODE_BodyAddTorque", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
BodyAddRelativeTorque = external_define("gm_ode.dll", "ODE_BodyAddRelativeTorque", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
// use: get number of joints attached to body
// params: body_id
// return: total number of joints attached to that body
BodyGetNumJoints = external_define("gm_ode.dll", "ODE_BodyGetNumJoints", dll_cdecl, ty_real, 1, ty_real)
// use: get the n-th joint attached to this body (use BodyGetNumJoints to get number of joints on body)
// NOTE: does NOT get contact joints, only joints you attached manually to this body. If the desired joint
// is a contact joint then -1 will be returned!
// params: body_id, index
// return: joint_id or -1 if joint was a contact joint
BodyGetJoint = external_define("gm_ode.dll", "ODE_BodyGetJoint", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: set/get whether the body is affected by gravity (new bodies are always affected by gravity)
// params: body_id, mode (true if body should be affected by gravity, false if not)
// return: gravity mode (true or false)
BodySetGravityMode = external_define("gm_ode.dll", "ODE_BodySetGravityMode", dll_cdecl, ty_real, 2, ty_real, ty_real)
BodyGetGravityMode = external_define("gm_ode.dll", "ODE_BodyGetGravityMode", dll_cdecl, ty_real, 1, ty_real)
// use: set and get auto disable flag, if flag is true then bodies will disable themselves when idle according to the parameters below
// params: body_id, new auto disable flag (default: false)
// return: current auto disable flag
BodySetAutoDisableFlag = external_define("gm_ode.dll", "ODE_BodySetAutoDisableFlag", dll_cdecl, ty_real, 2, ty_real, ty_real)
BodyGetAutoDisableFlag = external_define("gm_ode.dll", "ODE_BodyGetAutoDisableFlag", dll_cdecl, ty_real, 1, ty_real)
// use: set/get linear movement threshold before a body is considered idle
// params: body_id, new linear threshold (default: 0.01)
// return: current linear threshold
BodySetAutoDisableLinearThreshold = external_define("gm_ode.dll", "ODE_BodySetAutoDisableLinearThreshold", dll_cdecl, ty_real, 2, ty_real, ty_real)
BodyGetAutoDisableLinearThreshold = external_define("gm_ode.dll", "ODE_BodyGetAutoDisableLinearThreshold", dll_cdecl, ty_real, 1, ty_real)
// use: set/get angular rotation threshold before a body is considered idle
// params: body_id, new angular threshold (default: 0.01)
// return: current angular threshold
BodySetAutoDisableAngularThreshold = external_define("gm_ode.dll", "ODE_BodySetAutoDisableAngularThreshold", dll_cdecl, ty_real, 2, ty_real, ty_real)
BodyGetAutoDisableAngularThreshold= external_define("gm_ode.dll", "ODE_BodyGetAutoDisableAngularThreshold", dll_cdecl, ty_real, 1, ty_real)
// use: set/get number of steps before a body is considered idle
// params: body_id, new numer of steps (default: 10)
// return: current number of steps
BodySetAutoDisableSteps = external_define("gm_ode.dll", "ODE_BodySetAutoDisableSteps", dll_cdecl, ty_real, 2, ty_real, ty_real)
BodyGetAutoDisableSteps = external_define("gm_ode.dll", "ODE_BodyGetAutoDisableSteps", dll_cdecl, ty_real, 1, ty_real)
// use: set/get time before a body is considered idle
// params: body_id, new time (default: 0)
// return: current time
BodySetAutoDisableTime = external_define("gm_ode.dll", "ODE_BodySetAutoDisableTime", dll_cdecl, ty_real, 2, ty_real, ty_real)
BodyGetAutoDisableTime = external_define("gm_ode.dll", "ODE_BodyGetAutoDisableTime", dll_cdecl, ty_real, 1, ty_real)
// use: set auto disable defaults (use the world settings for this body)
// params: body_id
// return: always true
BodySetAutoDisableDefaults = external_define("gm_ode.dll", "ODE_BodySetAutoDisableDefaults", dll_cdecl, ty_real, 1, ty_real)
// use: set finite rotation mode of body (enabled or disabled)
// params: body_id, mode (true if finite rotation mode should be enabled, default: disabled)
// return: finite rotation mode (true or false)
BodySetFiniteRotationMode = external_define("gm_ode.dll", "ODE_BodySetFiniteRotationMode", dll_cdecl, ty_real, 2, ty_real, ty_real)
BodyGetFiniteRotationMode = external_define("gm_ode.dll", "ODE_BodyGetFiniteRotationMode", dll_cdecl, ty_real, 1, ty_real)
// use: set finite rotation axis of body (only used when finite rotation mode is enabled)
// params: body_id, x, y, z (vector)
// return: finite rotation axis x, y, z components of vector
BodySetFiniteRotationAxis = external_define("gm_ode.dll", "ODE_BodySetFiniteRotationAxis", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
BodyGetFiniteRotationAxisX = external_define("gm_ode.dll", "ODE_BodyGetFiniteRotationAxisX", dll_cdecl, ty_real, 1, ty_real)
BodyGetFiniteRotationAxisY = external_define("gm_ode.dll", "ODE_BodyGetFiniteRotationAxisY", dll_cdecl, ty_real, 1, ty_real)
BodyGetFiniteRotationAxisZ = external_define("gm_ode.dll", "ODE_BodyGetFiniteRotationAxisZ", dll_cdecl, ty_real, 1, ty_real)
// use: test wether two bodies are connected with a joint
// params: body1_id, body2_id
// return: true if connected, false if not
BodyAreConnected = external_define("gm_ode.dll", "ODE_BodyAreConnected", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: test wether two bodies are connected with a joint, excluding the given joint type (eg dJointTypeBall ...)
// params: body1_id, body2_id, joint_type (excluded from check)
// return: true if connected with joint of type other than joint_type, false if not connected or only with joint of type joint_type
BodyAreConnectedExcluding = external_define("gm_ode.dll", "ODE_BodyAreConnectedExcluding", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
// see ODE_DLL_Documentation script for further information ...
// use: create a geom resembling the given geom type (sphere, box, etc.)
// params: space_id (0 for world space), radius
// return: always true
GeomCreateSphere = external_define("gm_ode.dll", "ODE_GeomCreateSphere", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: set/get radius of sphere geom
// params: geom_id, radius
// return: radius
GeomSphereSetRadius = external_define("gm_ode.dll", "ODE_GeomSphereSetRadius", dll_cdecl, ty_real, 2, ty_real, ty_real)
GeomSphereGetRadius = external_define("gm_ode.dll", "ODE_GeomSphereGetRadius", dll_cdecl, ty_real, 1, ty_real)
// use: create a geom resembling the given geom type (sphere, box, etc.)
// params: space_id (0 for world space), lx, ly, lz (length of box' sides)
// return: always true
GeomCreateBox = external_define("gm_ode.dll", "ODE_GeomCreateBox", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
// use: set/get lengths of the sides of a box geom
// params: geom_id, lx, ly, lz (lengths of sides)
// return: lx, ly, lz (lenghts of sides)
GeomBoxSetLengths = external_define("gm_ode.dll", "ODE_GeomBoxSetLengths", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
GeomBoxGetLengthX = external_define("gm_ode.dll", "ODE_GeomBoxGetLengthX", dll_cdecl, ty_real, 1, ty_real)
GeomBoxGetLengthY = external_define("gm_ode.dll", "ODE_GeomBoxGetLengthY", dll_cdecl, ty_real, 1, ty_real)
GeomBoxGetLengthZ = external_define("gm_ode.dll", "ODE_GeomBoxGetLengthZ", dll_cdecl, ty_real, 1, ty_real)
// use: create a geom resembling the given geom type (sphere, box, etc.)
// a plane is a flat 2D geom which always touches the coordinate systems origin point (0,0,0) and has infinite length
// a plane is ideal for floor collisions
// params: space_id (0 for world space), a, b, c, d (plane normals, see ODE documentation)
// return: always true
GeomCreatePlane = external_define("gm_ode.dll", "ODE_GeomCreatePlane", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
// use: set/get params of plane geom
// params: geom_id, a, b, c, d (plane normals)
// return: a, b, c, d (plane normals)
GeomPlaneSetParams = external_define("gm_ode.dll", "ODE_GeomPlaneSetParams", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
GeomPlaneGetParamA = external_define("gm_ode.dll", "ODE_GeomPlaneGetParamA", dll_cdecl, ty_real, 1, ty_real)
GeomPlaneGetParamB = external_define("gm_ode.dll", "ODE_GeomPlaneGetParamB", dll_cdecl, ty_real, 1, ty_real)
GeomPlaneGetParamC = external_define("gm_ode.dll", "ODE_GeomPlaneGetParamC", dll_cdecl, ty_real, 1, ty_real)
GeomPlaneGetParamD = external_define("gm_ode.dll", "ODE_GeomPlaneGetParamD", dll_cdecl, ty_real, 1, ty_real)
// use: create a geom resembling the given geom type (sphere, box, etc.)
// params: space_id (0 for world space), radius, length
// return: always true
GeomCreateCappedCylinder = external_define("gm_ode.dll", "ODE_GeomCreateCappedCylinder", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
// use: set/get params of capped cylinder geom
// params: geom_id, radius, length
// return: radius, length
GeomCappedCylinderSetParams = external_define("gm_ode.dll", "ODE_GeomCappedCylinderSetParams", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
GeomCappedCylinderGetRadius = external_define("gm_ode.dll", "ODE_GeomCappedCylinderGetRadius", dll_cdecl, ty_real, 1, ty_real)
GeomCappedCylinderGetLength = external_define("gm_ode.dll", "ODE_GeomCappedCylinderGetLength", dll_cdecl, ty_real, 1, ty_real)
// use: create a geom resembling the given geom type (sphere, box, etc.)
// params: space_id (0 for world space), length
// return: always true
GeomCreateRay = external_define("gm_ode.dll", "ODE_GeomCreateRay", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: set/get length of ray geom
// params: geom_id, radius, length
// return: radius, length
GeomRaySetLength = external_define("gm_ode.dll", "ODE_GeomRaySetLength", dll_cdecl, ty_real, 2, ty_real, ty_real)
GeomRayGetLength = external_define("gm_ode.dll", "ODE_GeomRayGetLength", dll_cdecl, ty_real, 1, ty_real)
// use: set params of ray geom
// params: geom_id, px, py, pz (start point), dx, dy, dz (direction)
// return: px, py, pz, dx, dy, dz
GeomRaySetParams = external_define("gm_ode.dll", "ODE_GeomRaySetLength", dll_cdecl, ty_real, 7, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
GeomRayGetStartX = external_define("gm_ode.dll", "ODE_GeomRayGetStartX", dll_cdecl, ty_real, 1, ty_real)
GeomRayGetStartY = external_define("gm_ode.dll", "ODE_GeomRayGetStartY", dll_cdecl, ty_real, 1, ty_real)
GeomRayGetStartZ = external_define("gm_ode.dll", "ODE_GeomRayGetStartZ", dll_cdecl, ty_real, 1, ty_real)
GeomRayGetDirectionX = external_define("gm_ode.dll", "ODE_GeomRayGetDirectionX", dll_cdecl, ty_real, 1, ty_real)
GeomRayGetDirectionY = external_define("gm_ode.dll", "ODE_GeomRayGetDirectionY", dll_cdecl, ty_real, 1, ty_real)
GeomRayGetDirectionZ = external_define("gm_ode.dll", "ODE_GeomRayGetDirectionZ", dll_cdecl, ty_real, 1, ty_real)
// use: create a transform geom
// params: space_id (0 for world space)
// return: always true
GeomCreateTransform = external_define("gm_ode.dll", "ODE_GeomCreateTransform", dll_cdecl, ty_real, 1, ty_real)
// use: set/get geom of transform geom
// params: geom1_id, geom2_id
// return: geom_id
GeomTransformSetGeom = external_define("gm_ode.dll", "ODE_GeomTransformSetGeom", dll_cdecl, ty_real, 2, ty_real, ty_real)
GeomTransformGetGeom = external_define("gm_ode.dll", "ODE_GeomTransformGetGeom", dll_cdecl, ty_real, 1, ty_real)
// use: set/get cleanup mode of transform geom
// params: geom_id, mode (true to enable cleanup, false to disable)
// return: cleanup mode
GeomTransformSetCleanupMode = external_define("gm_ode.dll", "ODE_GeomTransformSetCleanupMode", dll_cdecl, ty_real, 2, ty_real, ty_real)
GeomTransformGetCleanupMode = external_define("gm_ode.dll", "ODE_GeomTransformGetCleanupMode", dll_cdecl, ty_real, 1, ty_real)
// use: set/get info mode of transform geom
// params: geom_id, mode (see ODE documentation)
// return: mode
GeomTransformSetInfo = external_define("gm_ode.dll", "ODE_GeomTransformSetInfo", dll_cdecl, ty_real, 2, ty_real, ty_real)
GeomTransformGetInfo = external_define("gm_ode.dll", "ODE_GeomTransformGetInfo", dll_cdecl, ty_real, 1, ty_real)
// use: get point depth of point relative to geom
// params: geom_id, x, y, z (point)
// return: depth (positive if inside geom, negative if outside)
GeomSphereGetPointDepth = external_define("gm_ode.dll", "ODE_GeomSphereGetPointDepth", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
GeomBoxGetPointDepth = external_define("gm_ode.dll", "ODE_GeomBoxGetPointDepth", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
GeomPlaneGetPointDepth = external_define("gm_ode.dll", "ODE_GeomPlaneGetPointDepth", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
GeomCappedCylinderGetPointDepth = external_define("gm_ode.dll", "ODE_GeomCappedCylinderGetPointDepth", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
// use: destroy a geom
// params: geom_id
// return: always true
GeomDestroy = external_define("gm_ode.dll", "ODE_GeomDestroy", dll_cdecl, ty_real, 1, ty_real)
// use: assign a geom to a body
// params: body_id, geom_id
// return: always true
GeomSetBody = external_define("gm_ode.dll", "ODE_GeomSetBody", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: get the body of the geom
// params: geom_id
// return: body_id
GeomGetBody = external_define("gm_ode.dll", "ODE_GeomGetBody", dll_cdecl, ty_real, 1, ty_real)
// use: set/get position of a geom, if geom is connected to a body this will also set the position of the body
// params: geom_id, x, y, z
// return: x, y, z respectively
GeomSetPosition = external_define("gm_ode.dll", "ODE_GeomSetPosition", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
GeomGetPositionX = external_define("gm_ode.dll", "ODE_GeomGetPositionX", dll_cdecl, ty_real, 1, ty_real)
GeomGetPositionY = external_define("gm_ode.dll", "ODE_GeomGetPositionY", dll_cdecl, ty_real, 1, ty_real)
GeomGetPositionZ = external_define("gm_ode.dll", "ODE_GeomGetPositionZ", dll_cdecl, ty_real, 1, ty_real)
// use: set/get rotation matrix of a geom
// params: geom_id, 11, 22, 33, 12, 13, 23 (elements of rotation matrix)
// return: elements of rotation matrix
GeomSetRotationMatrix = external_define("gm_ode.dll", "ODE_GeomSetRotationMatrix", dll_cdecl, ty_real, 7, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
GeomGetRotationMatrix11 = external_define("gm_ode.dll", "ODE_GeomGetRotationMatrix11", dll_cdecl, ty_real, 1, ty_real)
GeomGetRotationMatrix12 = external_define("gm_ode.dll", "ODE_GeomGetRotationMatrix12", dll_cdecl, ty_real, 1, ty_real)
GeomGetRotationMatrix13 = external_define("gm_ode.dll", "ODE_GeomGetRotationMatrix13", dll_cdecl, ty_real, 1, ty_real)
GeomGetRotationMatrix22 = external_define("gm_ode.dll", "ODE_GeomGetRotationMatrix22", dll_cdecl, ty_real, 1, ty_real)
GeomGetRotationMatrix23 = external_define("gm_ode.dll", "ODE_GeomGetRotationMatrix23", dll_cdecl, ty_real, 1, ty_real)
GeomGetRotationMatrix33 = external_define("gm_ode.dll", "ODE_GeomGetRotationMatrix33", dll_cdecl, ty_real, 1, ty_real)
// use: get direction of geom
// params: geom_id
// return: direction in degrees (0 to the right)
GeomGetDirection = external_define("gm_ode.dll", "ODE_GeomGetDirection", dll_cdecl, ty_real, 1, ty_real)
// use: test 2 geoms for collision and return whether they collide or not
// params: geom1_id, geom2_id
// return: true if collision, false if no collision
GeomCollide = external_define("gm_ode.dll", "ODE_GeomCollide", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: check if a given geom is a space
// params: geom_id
// return: true if geom is a space, false if not
GeomIsSpace = external_define("gm_ode.dll", "ODE_GeomIsSpace", dll_cdecl, ty_real, 1, ty_real)
// use: get the space_id of space containing this geom
// params: geom_id
// return: space_id
GeomGetSpace = external_define("gm_ode.dll", "ODE_GeomGetSpace", dll_cdecl, ty_real, 1, ty_real)
// use: get the class (type) of the geom
// the following geom classes are defined:
/*
dSphereClass = 0
dBoxClass = 1
dCCylinderClass = 2
dCylinderClass = 3
dPlaneClass = 4
dRayClass = 5
dGeomTransformClass = 6
dTriMeshClass = 7
dSimpleSpaceClass = 8
dHashSpaceClass = 9
dQuadTreeSpaceClass = 10
*/
// params: geom_id
// return: class number
GeomGetClass = external_define("gm_ode.dll", "ODE_GeomGetClass", dll_cdecl, ty_real, 1, ty_real)
// use: set/get the geom's category/collision bits, see ODE documentation for more info
// params: geom_id, bits
// return: bits
GeomSetCategoryBits = external_define("gm_ode.dll", "ODE_GeomSetCategoryBits", dll_cdecl, ty_real, 2, ty_real, ty_real)
GeomSetCollideBits = external_define("gm_ode.dll", "ODE_GeomSetCollideBits", dll_cdecl, ty_real, 2, ty_real, ty_real)
GeomGetCategoryBits = external_define("gm_ode.dll", "ODE_GeomGetCategoryBits", dll_cdecl, ty_real, 1, ty_real)
GeomGetCollideBits = external_define("gm_ode.dll", "ODE_GeomGetCollideBits", dll_cdecl, ty_real, 1, ty_real)
// use: enable/disable a geom
// by default all new geoms are enabled, meaning they can collide with other geoms
// disabled geoms do not collide with other geoms
// params: geom_id
// return: always true
GeomEnable = external_define("gm_ode.dll", "ODE_GeomEnable", dll_cdecl, ty_real, 1, ty_real)
GeomDisable = external_define("gm_ode.dll", "ODE_GeomDisable", dll_cdecl, ty_real, 1, ty_real)
// use: return wether the geom is enabled or not
// params: geom_id
// return: true if geom is enabled, false if not
GeomIsEnabled = external_define("gm_ode.dll", "ODE_GeomIsEnabled", dll_cdecl, ty_real, 1, ty_real)
// use: get geom bounding box parameters
// params: geom_id
// return: minx, miny, maxx, maxy, minz, maxz
GeomGetBoundingBoxMinX = external_define("gm_ode.dll", "ODE_GeomGetBoundingBoxMinX", dll_cdecl, ty_real, 1, ty_real)
GeomGetBoundingBoxMaxX = external_define("gm_ode.dll", "ODE_GeomGetBoundingBoxMaxX", dll_cdecl, ty_real, 1, ty_real)
GeomGetBoundingBoxMinY = external_define("gm_ode.dll", "ODE_GeomGetBoundingBoxMinY", dll_cdecl, ty_real, 1, ty_real)
GeomGetBoundingBoxMaxY = external_define("gm_ode.dll", "ODE_GeomGetBoundingBoxMaxY", dll_cdecl, ty_real, 1, ty_real)
GeomGetBoundingBoxMinZ = external_define("gm_ode.dll", "ODE_GeomGetBoundingBoxMinZ", dll_cdecl, ty_real, 1, ty_real)
GeomGetBoundingBoxMaxZ = external_define("gm_ode.dll", "ODE_GeomGetBoundingBoxMaxZ", dll_cdecl, ty_real, 1, ty_real)
// see ODE_DLL_Documentation script for further information ...
// use: create/destroy a group for joints, usually a single joint group for the world suffices
// there is a default group ODE.DefaultJointGroup that always exists
// params: none/jointgroup_id
// return: jointgroup_id/none
JointGroupCreate = external_define("gm_ode.dll", "ODE_JointGroupCreate", dll_cdecl, ty_real, 0)
JointGroupDestroy = external_define("gm_ode.dll", "ODE_JointGroupDestroy", dll_cdecl, ty_real, 1, ty_real)
// use: create different types of joints (see ODE documentation for details)
// note: in 2D games Ball, Hinge and Universal joints behave almost exaxtly the same. Hinge joints are preferable.
// params: jointgroup_id (usually 0)
// return: joint_id
JointCreateBall = external_define("gm_ode.dll", "ODE_JointCreateBall", dll_cdecl, ty_real, 1, ty_real)
JointCreateHinge = external_define("gm_ode.dll", "ODE_JointCreateHinge", dll_cdecl, ty_real, 1, ty_real)
JointCreateSlider = external_define("gm_ode.dll", "ODE_JointCreateSlider", dll_cdecl, ty_real, 1, ty_real)
JointCreateUniversal = external_define("gm_ode.dll", "ODE_JointCreateUniversal", dll_cdecl, ty_real, 1, ty_real)
JointCreateHinge2 = external_define("gm_ode.dll", "ODE_JointCreateHinge2", dll_cdecl, ty_real, 1, ty_real)
JointCreateAMotor = external_define("gm_ode.dll", "ODE_JointCreateAMotor", dll_cdecl, ty_real, 1, ty_real)
JointCreateFixed = external_define("gm_ode.dll", "ODE_JointCreateFixed", dll_cdecl, ty_real, 1, ty_real)
// use: destroy a joint
// params: joint_id
// return: always true
JointDestroy = external_define("gm_ode.dll", "ODE_JointDestroy", dll_cdecl, ty_real, 1, ty_real)
// use: attach a joint to two bodies
// params: joint_id, body_id of first body, body_id of second body
// return: always true
JointAttach = external_define("gm_ode.dll", "ODE_JointAttach", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
// use: get the type of a joint
// params: joint_id
// return: joint type, defined as follows:
/*
dJointTypeNone = 0
dJointTypeBall = 1
dJointTypeHinge = 2
dJointTypeSlider = 3
dJointTypeContact = 4
dJointTypeUniversal = 5
dJointTypeHinge2 = 6
dJointTypeFixed = 7
dJointTypeNull = 8
dJointTypeAMotor = 9
*/
JointGetType = external_define("gm_ode.dll", "ODE_JointGetType", dll_cdecl, ty_real, 1, ty_real)
// use: get the body of a joint
// params: joint_id, index (0 for first body, 1 for second body)
// return: body_id or -1 if the joint is connected to the world at that end, if both ends return -1 the joint is in "limbo" state
JointGetBody = external_define("gm_ode.dll", "ODE_JointGetBody", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: set/get ball joint parameters
// params: joint_id, x, y, z
// return: x, y, z of anchor 1 or 2
JointSetBallAnchor = external_define("gm_ode.dll", "ODE_JointSetBallAnchor", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointGetBallAnchor1X = external_define("gm_ode.dll", "ODE_JointGetBallAnchor1X", dll_cdecl, ty_real, 1, ty_real)
JointGetBallAnchor1Y = external_define("gm_ode.dll", "ODE_JointGetBallAnchor1Y", dll_cdecl, ty_real, 1, ty_real)
JointGetBallAnchor1Z = external_define("gm_ode.dll", "ODE_JointGetBallAnchor1Z", dll_cdecl, ty_real, 1, ty_real)
JointGetBallAnchor2X = external_define("gm_ode.dll", "ODE_JointGetBallAnchor2X", dll_cdecl, ty_real, 1, ty_real)
JointGetBallAnchor2Y = external_define("gm_ode.dll", "ODE_JointGetBallAnchor2Y", dll_cdecl, ty_real, 1, ty_real)
JointGetBallAnchor2Z = external_define("gm_ode.dll", "ODE_JointGetBallAnchor2Z", dll_cdecl, ty_real, 1, ty_real)
// use: set/get hinge joint parameters
// params: joint_id, x, y, z (anchor point or hinge axis)
// return: x, y, z of anchor 1 or 2 or axis
JointSetHingeAnchor = external_define("gm_ode.dll", "ODE_JointSetHingeAnchor", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointSetHingeAxis = external_define("gm_ode.dll", "ODE_JointSetHingeAxis", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointGetHingeAnchor1X = external_define("gm_ode.dll", "ODE_JointGetHingeAnchor1X", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAnchor1Y = external_define("gm_ode.dll", "ODE_JointGetHingeAnchor1Y", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAnchor1Z = external_define("gm_ode.dll", "ODE_JointGetHingeAnchor1Z", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAnchor2X = external_define("gm_ode.dll", "ODE_JointGetHingeAnchor2X", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAnchor2Y = external_define("gm_ode.dll", "ODE_JointGetHingeAnchor2Y", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAnchor2Z = external_define("gm_ode.dll", "ODE_JointGetHingeAnchor2Z", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAxisX = external_define("gm_ode.dll", "ODE_JointGetHingeAxisX", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAxisY = external_define("gm_ode.dll", "ODE_JointGetHingeAxisY", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAxisZ = external_define("gm_ode.dll", "ODE_JointGetHingeAxisZ", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAngle = external_define("gm_ode.dll", "ODE_JointGetHingeAngle", dll_cdecl, ty_real, 1, ty_real)
JointGetHingeAngleRate = external_define("gm_ode.dll", "ODE_JointGetHingeAngleRate", dll_cdecl, ty_real, 1, ty_real)
JointAddHingeTorque = external_define("gm_ode.dll", "ODE_JointAddHingeTorque", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: set/get slider joint parameters
// params: joint_id, x, y, z (slider axis)
// return: x, y, z of axis
JointSetSliderAxis = external_define("gm_ode.dll", "ODE_JointSetSliderAxis", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointGetSliderAxisX = external_define("gm_ode.dll", "ODE_JointGetSliderAxisX", dll_cdecl, ty_real, 1, ty_real)
JointGetSliderAxisY = external_define("gm_ode.dll", "ODE_JointGetSliderAxisY", dll_cdecl, ty_real, 1, ty_real)
JointGetSliderAxisZ = external_define("gm_ode.dll", "ODE_JointGetSliderAxisZ", dll_cdecl, ty_real, 1, ty_real)
JointGetSliderPosition = external_define("gm_ode.dll", "ODE_JointGetSliderPosition", dll_cdecl, ty_real, 1, ty_real)
JointGetSliderPositionRate = external_define("gm_ode.dll", "ODE_JointGetSliderPositionRate", dll_cdecl, ty_real, 1, ty_real)
JointAddSliderForce = external_define("gm_ode.dll", "ODE_JointAddSliderForce", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: set/get universal joint parameters
// params: joint_id, x, y, z (anchor point or axis1 or 2)
// return: x, y, z of anchor 1 or 2 or axis 1 or 2
JointSetUniversalAnchor = external_define("gm_ode.dll", "ODE_JointSetUniversalAnchor", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointSetUniversalAxis1 = external_define("gm_ode.dll", "ODE_JointSetUniversalAxis1", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointSetUniversalAxis2 = external_define("gm_ode.dll", "ODE_JointSetUniversalAxis2", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointGetUniversalAnchor1X = external_define("gm_ode.dll", "ODE_JointGetUniversalAnchor1X", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAnchor1Y = external_define("gm_ode.dll", "ODE_JointGetUniversalAnchor1Y", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAnchor1Z = external_define("gm_ode.dll", "ODE_JointGetUniversalAnchor1Z", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAnchor2X = external_define("gm_ode.dll", "ODE_JointGetUniversalAnchor2X", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAnchor2Y = external_define("gm_ode.dll", "ODE_JointGetUniversalAnchor2Y", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAnchor2Z = external_define("gm_ode.dll", "ODE_JointGetUniversalAnchor2Z", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAxis1X = external_define("gm_ode.dll", "ODE_JointGetUniversalAxis1X", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAxis1Y = external_define("gm_ode.dll", "ODE_JointGetUniversalAxis1Y", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAxis1Z = external_define("gm_ode.dll", "ODE_JointGetUniversalAxis1Z", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAxis2X = external_define("gm_ode.dll", "ODE_JointGetUniversalAxis2X", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAxis2Y = external_define("gm_ode.dll", "ODE_JointGetUniversalAxis2Y", dll_cdecl, ty_real, 1, ty_real)
JointGetUniversalAxis2Z = external_define("gm_ode.dll", "ODE_JointGetUniversalAxis2Z", dll_cdecl, ty_real, 1, ty_real)
JointAddUniversalTorques = external_define("gm_ode.dll", "ODE_JointAddUniversalTorques", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
// use: set the fixed joint as "fixed" (connected bodies don't change their relative position)
// params: joint_id
// return: always true
JointSetFixed = external_define("gm_ode.dll", "ODE_JointSetFixed", dll_cdecl, ty_real, 1, ty_real)
// use: set the hinge2 joint parameters
// params: joint_id, x, y, z (anchor point or axis 1 or 2)
// return: x, y, z of anchor 1 or 2 or axis 1 or 2
JointSetHinge2Anchor = external_define("gm_ode.dll", "ODE_JointSetHinge2Anchor", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointSetHinge2Axis1 = external_define("gm_ode.dll", "ODE_JointSetHinge2Axis1", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointSetHinge2Axis2 = external_define("gm_ode.dll", "ODE_JointSetHinge2Axis2", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
JointGetHinge2Anchor1X = external_define("gm_ode.dll", "ODE_JointGetHinge2Anchor1X", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Anchor1Y = external_define("gm_ode.dll", "ODE_JointGetHinge2Anchor1Y", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Anchor1Z = external_define("gm_ode.dll", "ODE_JointGetHinge2Anchor1Z", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Anchor2X = external_define("gm_ode.dll", "ODE_JointGetHinge2Anchor2X", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Anchor2Y = external_define("gm_ode.dll", "ODE_JointGetHinge2Anchor2Y", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Anchor2Z = external_define("gm_ode.dll", "ODE_JointGetHinge2Anchor2Z", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Axis1X = external_define("gm_ode.dll", "ODE_JointGetHinge2Axis1X", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Axis1Y = external_define("gm_ode.dll", "ODE_JointGetHinge2Axis1Y", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Axis1Z = external_define("gm_ode.dll", "ODE_JointGetHinge2Axis1Z", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Axis2X = external_define("gm_ode.dll", "ODE_JointGetHinge2Axis2X", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Axis2Y = external_define("gm_ode.dll", "ODE_JointGetHinge2Axis2Y", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Axis2Z = external_define("gm_ode.dll", "ODE_JointGetHinge2Axis2Z", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Angle1 = external_define("gm_ode.dll", "ODE_JointGetHinge2Angle1", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Angle1Rate = external_define("gm_ode.dll", "ODE_JointGetHinge2Angle1Rate", dll_cdecl, ty_real, 1, ty_real)
JointGetHinge2Angle2Rate = external_define("gm_ode.dll", "ODE_JointGetHinge2Angle2Rate", dll_cdecl, ty_real, 1, ty_real)
JointAddHinge2Torques = external_define("gm_ode.dll", "ODE_JointAddHinge2Torques", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
// use: set the AMotor mode
// mode can be either:
// dAMotorUser = 0
// dAMotorEuler = 1
// params: joint_id, mode
// return: mode
JointSetAMotorMode = external_define("gm_ode.dll", "ODE_JointSetAMotorMode", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointGetAMotorMode = external_define("gm_ode.dll", "ODE_JointGetAMotorMode", dll_cdecl, ty_real, 1, ty_real)
// use: set the AMotor joint axes
// params: joint_id, number of axes (0-3)
// return: number of axes
JointSetAMotorNumAxes = external_define("gm_ode.dll", "ODE_JointSetAMotorNumAxes", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointGetAMotorNumAxes = external_define("gm_ode.dll", "ODE_JointGetAMotorNumAxes", dll_cdecl, ty_real, 1, ty_real)
// use: set the AMotor joint axis
// params: joint_id, axis (0-2), rel (0-2), x, y, z
// return: always true
JointSetAMotorAxis = external_define("gm_ode.dll", "ODE_JointSetAMotorAxis", dll_cdecl, ty_real, 6, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
// use: get the AMotor joint axis
// params: joint_id, axis (0-2)
// return: x, y, z of axis
JointGetAMotorAxisX = external_define("gm_ode.dll", "ODE_JointGetAMotorAxisX", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointGetAMotorAxisY = external_define("gm_ode.dll", "ODE_JointGetAMotorAxisY", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointGetAMotorAxisZ = external_define("gm_ode.dll", "ODE_JointGetAMotorAxisZ", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointGetAMotorAxisRelative = external_define("gm_ode.dll", "ODE_JointGetAMotorAxisRelative", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetAMotorAngle = external_define("gm_ode.dll", "ODE_JointSetAMotorAngle", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
JointGetAMotorAngle = external_define("gm_ode.dll", "ODE_JointGetAMotorAngle", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointGetAMotorAngleRate = external_define("gm_ode.dll", "ODE_JointGetAMotorAngleRate", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointAddAMotorTorques = external_define("gm_ode.dll", "ODE_JointAddAMotorTorques", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
// use: set general joint parameters (see ODE documentation)
// params: joint_id, parameter
// return: always true
JointSetParamLoStop = external_define("gm_ode.dll", "ODE_JointSetParamLoStop", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamHiStop = external_define("gm_ode.dll", "ODE_JointSetParamHiStop", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamVel = external_define("gm_ode.dll", "ODE_JointSetParamVel", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamFMax = external_define("gm_ode.dll", "ODE_JointSetParamFMax", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamFudgeFactor = external_define("gm_ode.dll", "ODE_JointSetParamFudgeFactor", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamBounce = external_define("gm_ode.dll", "ODE_JointSetParamBounce", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamCFM = external_define("gm_ode.dll", "ODE_JointSetParamCFM", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamStopERP = external_define("gm_ode.dll", "ODE_JointSetParamStopERP", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamStopCFM = external_define("gm_ode.dll", "ODE_JointSetParamStopCFM", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamSuspensionERP = external_define("gm_ode.dll", "ODE_JointSetParamSuspensionERP", dll_cdecl, ty_real, 2, ty_real, ty_real)
JointSetParamSuspensionCFM = external_define("gm_ode.dll", "ODE_JointSetParamSuspensionCFM", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: enable/disable feedback for the given joint, if enabled "force feedback" can be obtained by calling the following functions
// params: joint_id
// return: always true
JointEnableFeedback = external_define("gm_ode.dll", "ODE_JointEnableFeedback", dll_cdecl, ty_real, 1, ty_real)
JointDisableFeedback = external_define("gm_ode.dll", "ODE_JointDisableFeedback", dll_cdecl, ty_real, 1, ty_real)
// use: get force/torque feedback for a joint, joint feedback has to be enabled for this joint!
// params: joint_id
// return: x, y, z of force 1 or 2 or torque 1 or 2
JointGetFeedbackForce1X = external_define("gm_ode.dll", "ODE_JointGetFeedbackForce1X", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackForce1Y = external_define("gm_ode.dll", "ODE_JointGetFeedbackForce1Y", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackForce1Z = external_define("gm_ode.dll", "ODE_JointGetFeedbackForce1Z", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackForce2X = external_define("gm_ode.dll", "ODE_JointGetFeedbackForce2X", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackForce2Y = external_define("gm_ode.dll", "ODE_JointGetFeedbackForce2Y", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackForce2Z = external_define("gm_ode.dll", "ODE_JointGetFeedbackForce2Z", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackTorque1X = external_define("gm_ode.dll", "ODE_JointGetFeedbackTorque1X", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackTorque1Y = external_define("gm_ode.dll", "ODE_JointGetFeedbackTorque1Y", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackTorque1Z = external_define("gm_ode.dll", "ODE_JointGetFeedbackTorque1Z", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackTorque2X = external_define("gm_ode.dll", "ODE_JointGetFeedbackTorque2X", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackTorque2Y = external_define("gm_ode.dll", "ODE_JointGetFeedbackTorque2Y", dll_cdecl, ty_real, 1, ty_real)
JointGetFeedbackTorque2Z = external_define("gm_ode.dll", "ODE_JointGetFeedbackTorque2Z", dll_cdecl, ty_real, 1, ty_real)
// see ODE_DLL_Documentation script for further information ...
// use: create a new mass
// params: none
// return: mass_id
MassCreate = external_define("gm_ode.dll", "ODE_MassCreate", dll_cdecl, ty_real, 0)
// use: destroy an existing mass
// params: mass_id
// return: always true
MassDestroy = external_define("gm_ode.dll", "ODE_MassDestroy", dll_cdecl, ty_real, 1, ty_real)
// use: set the mass shaped as a sphere
// params: mass_id, density or total mass ("Total" function), radius
// return: always true
MassSetSphere = external_define("gm_ode.dll", "ODE_MassSetSphere", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
MassSetSphereTotal = external_define("gm_ode.dll", "ODE_MassSetSphereTotal", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
// use: set the mass shaped as a capped cylinder
// params: mass_id, density or total mass ("Total" function), direction, radius, length
// return: always true
MassSetCappedCylinder = external_define("gm_ode.dll", "ODE_MassSetCappedCylinder", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
MassSetCappedCylinderTotal = external_define("gm_ode.dll", "ODE_MassSetCappedCylinderTotal", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
// use: set the mass shaped as a cylinder
// params: mass_id, density or total mass ("Total" function), direction, radius, length
// return: always true
MassSetCylinder = external_define("gm_ode.dll", "ODE_MassSetCylinder", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
MassSetCylinderTotal = external_define("gm_ode.dll", "ODE_MassSetCylinderTotal", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
// use: set the mass shaped as a box
// params: mass_id, density or total mass ("Total" function), lx, ly, lz
// return: always true
MassSetBox = external_define("gm_ode.dll", "ODE_MassSetBox", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
MassSetBoxTotal = external_define("gm_ode.dll", "ODE_MassSetBoxTotal", dll_cdecl, ty_real, 5, ty_real, ty_real, ty_real, ty_real, ty_real)
// use: set all mass parameters to 0 (no mass)
// params: mass_id
// return: always true
MassSetZero = external_define("gm_ode.dll", "ODE_MassSetZero", dll_cdecl, ty_real, 1, ty_real)
// use: set the mass parameters
// params: mass_id, total mass, cgx, cgy, cgz (center of gravity), i11, i22, i33, i12, i13, i23 (inertia matrix components)
// return: always true
MassSetParameters = external_define("gm_ode.dll", "ODE_MassSetParameters", dll_cdecl, ty_real, 11, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
// use: adjust the mass of a mass
// params: mass_id, new mass
// return: always true
MassAdjust = external_define("gm_ode.dll", "ODE_MassAdjust", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: translate the mass
// params: mass_id, x, y, z
// return: always true
MassTranslate = external_define("gm_ode.dll", "ODE_MassTranslate", dll_cdecl, ty_real, 4, ty_real, ty_real, ty_real, ty_real)
// use: rotate the mass
// params: mass_id, i11, i22, i33, i12, i13, i23 (rotation matrix components)
// return: always true
MassRotate = external_define("gm_ode.dll", "ODE_MassRotate", dll_cdecl, ty_real, 7, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real, ty_real)
// use: add the mass of a mass to the mass of another mass (try to speak that out loud and fast! *G*)
// params: mass1_id, mass2_id
// return: always true
MassAdd = external_define("gm_ode.dll", "ODE_MassAdd", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: get the mass of a mass
// params: mass_id
// return: mass
MassGetMass = external_define("gm_ode.dll", "ODE_MassGetMass", dll_cdecl, ty_real, 1, ty_real)
// use: get the center of gravity of a mass
// params: mass_id
// return: gravity center x, y, z
MassGetGravityCenterX = external_define("gm_ode.dll", "ODE_MassGetGravityCenterX", dll_cdecl, ty_real, 1, ty_real)
MassGetGravityCenterY = external_define("gm_ode.dll", "ODE_MassGetGravityCenterY", dll_cdecl, ty_real, 1, ty_real)
MassGetGravityCenterZ = external_define("gm_ode.dll", "ODE_MassGetGravityCenterZ", dll_cdecl, ty_real, 1, ty_real)
// use: get the inertia tensor matrix of a mass
// params: mass_id
// return: inertia tensor matrix component
MassGetInertiaMatrix11 = external_define("gm_ode.dll", "ODE_MassGetInertiaMatrix11", dll_cdecl, ty_real, 1, ty_real)
MassGetInertiaMatrix12 = external_define("gm_ode.dll", "ODE_MassGetInertiaMatrix12", dll_cdecl, ty_real, 1, ty_real)
MassGetInertiaMatrix13 = external_define("gm_ode.dll", "ODE_MassGetInertiaMatrix13", dll_cdecl, ty_real, 1, ty_real)
MassGetInertiaMatrix22 = external_define("gm_ode.dll", "ODE_MassGetInertiaMatrix22", dll_cdecl, ty_real, 1, ty_real)
MassGetInertiaMatrix23 = external_define("gm_ode.dll", "ODE_MassGetInertiaMatrix23", dll_cdecl, ty_real, 1, ty_real)
MassGetInertiaMatrix33 = external_define("gm_ode.dll", "ODE_MassGetInertiaMatrix33", dll_cdecl, ty_real, 1, ty_real)
// returns which type of DLL is used (single or double precision, debug or release DLL)
IsSinglePrecision = external_define("gm_ode.dll", "ODE_IsSinglePrecision", dll_cdecl, ty_real, 0)
IsDoublePrecision = external_define("gm_ode.dll", "ODE_IsDoublePrecision", dll_cdecl, ty_real, 0)
IsDebugDLL = external_define("gm_ode.dll", "ODE_IsDebugDLL", dll_cdecl, ty_real, 0)
IsReleaseDLL = external_define("gm_ode.dll", "ODE_IsReleaseDLL", dll_cdecl, ty_real, 0)
// version number information
GetDLLBuildNumber = external_define("gm_ode.dll", "ODE_GetDLLBuildNumber", dll_cdecl, ty_real, 0)
GetODEVersionNumberHigh = external_define("gm_ode.dll", "ODE_GetVersionNumberHigh", dll_cdecl, ty_real, 0)
GetODEVersionNumberLow = external_define("gm_ode.dll", "ODE_GetVersionNumberLow", dll_cdecl, ty_real, 0)
// see ODE_DLL_Documentation script for further information ...
// use: create a new space of the given type
// there is always a global hash space with space_id 0
// params: parent space or 0
// return: space_id
SpaceCreateSimple = external_define("gm_ode.dll", "ODE_SpaceCreateSimple", dll_cdecl, ty_real, 1, ty_real)
SpaceCreateHash = external_define("gm_ode.dll", "ODE_SpaceCreateHash", dll_cdecl, ty_real, 1, ty_real)
// use: destroy a space
// params: space_id
// return: always true
SpaceDestroy = external_define("gm_ode.dll", "ODE_SpaceDestroy", dll_cdecl, ty_real, 1, ty_real)
// use: add a geom to space or remove it
// params: space_id, geom_id
// return: always true
SpaceAddGeom = external_define("gm_ode.dll", "ODE_SpaceAddGeom", dll_cdecl, ty_real, 2, ty_real, ty_real)
SpaceRemoveGeom = external_define("gm_ode.dll", "ODE_SpaceRemoveGeom", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: set/get hash space parameters
// params: space_id, minlevel, maxlevel
// return: minlevel or maxlevel
SpaceSetHashLevels = external_define("gm_ode.dll", "ODE_SpaceSetHashLevels", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
SpaceGetHashMinLevel = external_define("gm_ode.dll", "ODE_SpaceGetHashMinLevel", dll_cdecl, ty_real, 1, ty_real)
SpaceGetHashMaxLevel = external_define("gm_ode.dll", "ODE_SpaceGetHashMaxLevel", dll_cdecl, ty_real, 1, ty_real)
// use: set/get space cleanup mode (enabled by default, that means destroying a space also destroys all geoms in that space)
// params: space_id, cleanupmode (true to enable, false to disable)
// return: cleanupmode (true if enabled, false if disabled)
SpaceSetCleanupMode = external_define("gm_ode.dll", "ODE_SpaceSetCleanupMode", dll_cdecl, ty_real, 2, ty_real, ty_real)
SpaceGetCleanupMode = external_define("gm_ode.dll", "ODE_SpaceGetCleanupMode", dll_cdecl, ty_real, 1, ty_real)
// use: test wether the geom is part of the space
// params: space_id, geom_id
// return: true if geom is part of the space, false if not
SpaceQueryForGeom = external_define("gm_ode.dll", "ODE_SpaceQueryForGeom", dll_cdecl, ty_real, 2, ty_real, ty_real)
// use: get number of geoms in that space
// params: space_id
// return: number of geoms
SpaceGetNumGeoms = external_define("gm_ode.dll", "ODE_SpaceGetNumGeoms", dll_cdecl, ty_real, 1, ty_real)
// use: get a specific geom by index from the space
// index must be in range 0 to SpaceGetNumGeoms - 1
// params: space_id, index
// return: geom_id or -1 if geom not found
SpaceGetGeom = external_define("gm_ode.dll", "ODE_SpaceGetGeom", dll_cdecl, ty_real, 2, ty_real, ty_real)
// see ODE_DLL_Documentation script for further information ...
// use: create and destroy the world, initializing and destroying ODE as well
// the very first ODE call should always be WorldCreate!
// params: window_handle() (not used for anything right now)
// return: always true
WorldCreate = external_define("gm_ode.dll", "ODE_WorldCreate", dll_cdecl, ty_real, 1, ty_real)
WorldDestroy = external_define("gm_ode.dll", "ODE_WorldDestroy", dll_cdecl, ty_real, 0)
// use: advance the world by one step (moving & rotating objects, does NOT include collision checking!)
// quickstep is the preferred method for games, it is less accurate but faster and uses less memory
// most of the time you wouldn't notice the difference between the two functions, so stick with QuickStep
// params: none
// return: always true
WorldStep = external_define("gm_ode.dll", "ODE_WorldStep", dll_cdecl, ty_real, 0)
WorldQuickStep = external_define("gm_ode.dll", "ODE_WorldQuickStep", dll_cdecl, ty_real, 0)
// use: perform a collision test on all spaces, if spaces overlap,
// perform a collision test on the geoms inside the space, if some geoms touch,
// bounce them off of each other
// params: none
// return: always true
WorldCollide = external_define("gm_ode.dll", "ODE_SpaceCollide", dll_cdecl, ty_real, 0)
// use: set/get contact mode bits, determining what "actions" result from a collision
// for every mode bit set you should also set the according parameter value to something meaningful
// these contact mode bits are currently defined:
/*
dContactModeBitMu2 = 1
dContactModeBitFDir1 = 2
dContactModeBitBounce = 4
dContactModeBitSoftERP = 8
dContactModeBitSoftCFM = 16
dContactModeBitMotion1 = 32
dContactModeBitMotion2 = 64
dContactModeBitSlip1 = 128
dContactModeBitSlip2 = 256
dContactModeBitApprox0 = 0
dContactModeBitApprox1_1= 4096
dContactModeBitApprox1_2= 8192
dContactModeBitApprox1 = 12288
*/
// params: mode bits
// return: mode bits
WorldSetContactModeBits = external_define("gm_ode.dll", "ODE_SetContactModeBits", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeBits = external_define("gm_ode.dll", "ODE_GetContactModeBits", dll_cdecl, ty_real, 0)
// use: set/get contact mode params, determining just how bodies behave when they collide
// for the parameters to have any effect the according bit has to be set as well!
// see the ODE documentation under Joints - Contacts for more information...
// params: respective params
// return: respective params
WorldSetContactModeParamMu = external_define("gm_ode.dll", "ODE_SetContactModeParamMu", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamMu2 = external_define("gm_ode.dll", "ODE_SetContactModeParamMu2", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamBounce = external_define("gm_ode.dll", "ODE_SetContactModeParamBounce", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamBounceVel = external_define("gm_ode.dll", "ODE_SetContactModeParamBounceVel", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamSoftERP = external_define("gm_ode.dll", "ODE_SetContactModeParamSoftERP", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamSoftCFM = external_define("gm_ode.dll", "ODE_SetContactModeParamSoftCFM", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamMotion1 = external_define("gm_ode.dll", "ODE_SetContactModeParamMotion1", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamMotion2 = external_define("gm_ode.dll", "ODE_SetContactModeParamMotion2", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamSlip1 = external_define("gm_ode.dll", "ODE_SetContactModeParamSlip1", dll_cdecl, ty_real, 1, ty_real)
WorldSetContactModeParamSlip2 = external_define("gm_ode.dll", "ODE_SetContactModeParamSlip2", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamMu = external_define("gm_ode.dll", "ODE_GetContactModeParamMu", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamMu2 = external_define("gm_ode.dll", "ODE_GetContactModeParamMu2", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamBounce = external_define("gm_ode.dll", "ODE_GetContactModeParamBounce", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamBounceVel = external_define("gm_ode.dll", "ODE_GetContactModeParamBounceVel", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamSoftERP = external_define("gm_ode.dll", "ODE_GetContactModeParamSoftERP", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamSoftCFM = external_define("gm_ode.dll", "ODE_GetContactModeParamSoftCFM", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamMotion1 = external_define("gm_ode.dll", "ODE_GetContactModeParamMotion1", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamMotion2 = external_define("gm_ode.dll", "ODE_GetContactModeParamMotion2", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamSlip1 = external_define("gm_ode.dll", "ODE_GetContactModeParamSlip1", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactModeParamSlip2 = external_define("gm_ode.dll", "ODE_GetContactModeParamSlip2", dll_cdecl, ty_real, 1, ty_real)
// use: set/get maximum number of contact points that may be created when bodies collide
// 2-4 contact points should be enough, 4 is the default, max is 16
// params: new number of max. contact points
// return: current number of max. contact points
WorldSetMaximumContacts = external_define("gm_ode.dll", "ODE_SetMaximumContacts", dll_cdecl, ty_real, 1, ty_real)
WorldGetMaximumContacts = external_define("gm_ode.dll", "ODE_GetMaximumContacts", dll_cdecl, ty_real, 0)
// use: empty contact joint group containing all contact joints from last Collide() call
// if you do not empty the contact joint group every step they will quickly slow down the game!
// params: none
// return: always true
WorldClearContactJoints = external_define("gm_ode.dll", "ODE_WorldClearContactJoints", dll_cdecl, ty_real, 0)
// use: set and get number of iterations per quick step, decreasing this value may gain some performance at the loss of accuracy
// params: new number of iterations (default: 20, i recommend using at least 5 iterations)
// return: current number of iterations
WorldSetQuickStepIterations = external_define("gm_ode.dll", "ODE_WorldSetQuickStepIterations", dll_cdecl, ty_real, 1, ty_real)
WorldGetQuickStepIterations = external_define("gm_ode.dll", "ODE_WorldGetQuickStepIterations", dll_cdecl, ty_real, 0)
// use: stepsize = amount of time the world is advanced in each step
// params: new stepsize (default: 0.05 seconds)
// return: current stepsize
WorldSetStepSize = external_define("gm_ode.dll", "ODE_WorldSetStepSize", dll_cdecl, ty_real, 1, ty_real)
WorldGetStepSize = external_define("gm_ode.dll", "ODE_WorldGetStepSize", dll_cdecl, ty_real, 0)
// use: set and get gravity affecting all objects in the world
// params: x, y, z (direction vector, positive y means gravity to bottom of screen)
// return: x, y, z direction vector component of gravity respectively
WorldSetGravity = external_define("gm_ode.dll", "ODE_WorldSetGravity", dll_cdecl, ty_real, 3, ty_real, ty_real, ty_real)
WorldGetGravityX = external_define("gm_ode.dll", "ODE_WorldGetGravityX", dll_cdecl, ty_real, 0)
WorldGetGravityY = external_define("gm_ode.dll", "ODE_WorldGetGravityY", dll_cdecl, ty_real, 0)
WorldGetGravityZ = external_define("gm_ode.dll", "ODE_WorldGetGravityZ", dll_cdecl, ty_real, 0)
// FIXME: set gravity by direction (in degrees) and strength alone
// use: set and get ERP (Error Reduction Parameter), determines the amount of error correction applied to all joints per step
// params: new ERP (value between 0 and 1, default: 0.2)
// return: current ERP value
WorldSetERP = external_define("gm_ode.dll", "ODE_WorldSetERP", dll_cdecl, ty_real, 1, ty_real)
WorldGetERP = external_define("gm_ode.dll", "ODE_WorldGetERP", dll_cdecl, ty_real, 0)
// use: set and get CFM (Constraint Force Mixing), determining the "softness" of joints (amount of deviation/penetration allowed)
// params: new CFM (value between 0 and 1, default: 0.00001)
// return: current CFM value
WorldSetCFM = external_define("gm_ode.dll", "ODE_WorldSetCFM", dll_cdecl, ty_real, 1, ty_real)
WorldGetCFM = external_define("gm_ode.dll", "ODE_WorldGetCFM", dll_cdecl, ty_real, 0)
// use: set and get auto disable flag, if flag is true then bodies will disable themselves when idle according to the parameters below
// params: new auto disable flag (default: false)
// return: current auto disable flag
WorldSetAutoDisableFlag = external_define("gm_ode.dll", "ODE_WorldSetAutoDisableFlag", dll_cdecl, ty_real, 1, ty_real)
WorldGetAutoDisableFlag = external_define("gm_ode.dll", "ODE_WorldGetAutoDisableFlag", dll_cdecl, ty_real, 0)
// use: set/get linear movement threshold before a body is considered idle
// params: new linear threshold (default: 0.01)
// return: current linear threshold
WorldSetAutoDisableLinearThreshold = external_define("gm_ode.dll", "ODE_WorldSetAutoDisableLinearThreshold", dll_cdecl, ty_real, 1, ty_real)
WorldGetAutoDisableLinearThreshold = external_define("gm_ode.dll", "ODE_WorldGetAutoDisableLinearThreshold", dll_cdecl, ty_real, 0)
// use: set/get angular rotation threshold before a body is considered idle
// params: new angular threshold (default: 0.01)
// return: current angular threshold
WorldSetAutoDisableAngularThreshold = external_define("gm_ode.dll", "ODE_WorldSetAutoDisableAngularThreshold", dll_cdecl, ty_real, 1, ty_real)
WorldGetAutoDisableAngularThreshold= external_define("gm_ode.dll", "ODE_WorldGetAutoDisableAngularThreshold", dll_cdecl, ty_real, 0)
// use: set/get number of steps before a body is considered idle
// params: new numer of steps (default: 10)
// return: current number of steps
WorldSetAutoDisableSteps = external_define("gm_ode.dll", "ODE_WorldSetAutoDisableSteps", dll_cdecl, ty_real, 1, ty_real)
WorldGetAutoDisableSteps = external_define("gm_ode.dll", "ODE_WorldGetAutoDisableSteps", dll_cdecl, ty_real, 0)
// use: set/get time before a body is considered idle
// params: new time (default: 0)
// return: current time
WorldSetAutoDisableTime = external_define("gm_ode.dll", "ODE_WorldSetAutoDisableTime", dll_cdecl, ty_real, 1, ty_real)
WorldGetAutoDisableTime = external_define("gm_ode.dll", "ODE_WorldGetAutoDisableTime", dll_cdecl, ty_real, 0)
// use: set/get maximum correcting velocity for contacts, reducing the velocity can prevent deeply embedded objects from going "nuts"
// eg they accumulate too much force and spin wildly with high speeds, possibly even moving through the room borders.
// params: new maximum correcting velocity (default: "infinity", negative values are interpreted as "infinity")
// return: current maximum correcting velocity
WorldSetContactMaxCorrectingVelocity = external_define("gm_ode.dll", "ODE_WorldSetContactMaxCorrectingVelocity", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactMaxCorrectingVelocity = external_define("gm_ode.dll", "ODE_WorldGetContactMaxCorrectingVelocity", dll_cdecl, ty_real, 0)
// use: set/get depth of contact surfaces, increasing this to 0.001 can reduce jittering problems
// params: new contact depth
// return: current contact depth
WorldSetContactSurfaceLayer= external_define("gm_ode.dll", "ODE_WorldSetContactSurfaceLayer", dll_cdecl, ty_real, 1, ty_real)
WorldGetContactSurfaceLayer= external_define("gm_ode.dll", "ODE_WorldGetContactSurfaceLayer", dll_cdecl, ty_real, 0)
// use: clear Z position of all bodies in the world, restricting them to movement on the x,y 2D plane only
// this is useful because at high speeds slight errors might occur that will force bodies to begin moving along the Z axis
// which in effect makes them stop colliding with other objects because they may be "behind" the other bodies
// it will also make bodies stop rotating along the Z axis
// call this *after* the world step function if you don't want full 3D movement/rotation which should be ok for most uses in GM
// params: none
// return: always true
WorldConstrainBodiesTo2DMotion = external_define("gm_ode.dll", "ODE_WorldConstrainBodiesTo2DMotion", dll_cdecl, ty_real, 0)