By Walaber
All Coding between 1.31-1.32B by Kjelle
Updated to 1.53 by Tiresius
NDB_GetVersion |
|||
| syntax: float = NDB_GetVersion() | |||
|
|||
| returns: float value containing current wrapper version. |
NDB_NewtonWorldGetVersion |
|||
| syntax: float = NDB_NewtonWorldGetVersion() | |||
|
|||
|
returns: release decimal three digit value x.xx the first digit: is major version number (interface changes among other things) the second digit: is major patch number (new features, and bug fixes) third digit: is minor bug fixed patch. |
|||
| Comments: V1.31 |
NDB_GetElapsedTimeInSec |
|||
| syntax: float = NDB_GetElapsedTimeInSec() | |||
|
|||
| returns: float value containing time elapsed since last call to the function (in seconds) | |||
| Comments: This is a simple function using the high-resolution timer. You can of course use the timer() function in DBPro, but this function saves some time by converting to seconds for you. |
NDB_SetVector |
|||||||||||||||
| syntax: NDB_SetVector [vec_num,] x, y, z [,w] | |||||||||||||||
|
|||||||||||||||
| returns: nothing | |||||||||||||||
| Comments: Many Newton functions require you to pass in a 3D vector (sometimes even 2), along with others. There are also many Newton functions that return a vector. Because DBPro can't have a function return more than one number, there is a temporary vector system built into the wrapper. The system has 4 internal vectors that can be used for temporary number storage. This command sets the vector to a set value. You can specify what vector to fill (1-4) first, followed by the x, y, and z values. an optional 4th value (w) is also available. If you don't specify a vector number, vector number 1 is used by default. If you don't specify a "w" value, 1.0 is used by default. | |||||||||||||||
| NDB_SetVector 1.0, 2.0, 3.0 (sets
vector number 1 to {x=1.0, y=2.0, z=3.0, w=1.0} NDB_SetVector 2, 1.0, 2.0, 3.0, 4.0 (sets vector number 2 to {x=1.0, y=2.0, z=3.0, w=4.0} |
NDB_GetVector_X |
|||
| syntax: float = NDB_GetVector_X( [vec_num] ) | |||
|
|||
| returns: float containing the X component of the vector. | |||
| Comments: if no vector is specified, vector 1 is used. | |||
|
x1# = NDB_GetVector_X() returns x value of
temp vector 1 x3# = NDB_GetVector_X(3) returns x value of temp vector 3 |
NDB_GetVector_Y |
|||
| syntax: float = NDB_GetVector_Y( [vec_num] ) | |||
|
|||
| returns: float containing the Y component of the vector. | |||
| Comments: if no vector is specified, vector 1 is used. | |||
|
y1# = NDB_GetVector_Y() returns y value of
temp vector 1 y3# = NDB_GetVector_Y(3) returns y value of temp vector 3 |
NDB_GetVector_Z |
|||
| syntax: float = NDB_GetVector_Z( [vec_num] ) | |||
|
|||
| returns: float containing the Z component of the vector. | |||
| Comments: if no vector is specified, vector 1 is used. | |||
|
z1# = NDB_GetVector_Z() returns z value of
temp vector 1 z3# = NDB_GetVector_Z(3) returns z value of temp vector 3 |
NDB_GetVector_W |
|||
| syntax: float = NDB_GetVector_W( [vec_num] ) | |||
|
|||
| returns: float containing the W component of the vector. | |||
| Comments: if no vector is specified, vector 1 is used. | |||
|
w1# = NDB_GetVector_W() returns w value of
temp vector 1 w3# = NDB_GetVector_W(3) returns w value of temp vector 3 |
NDB_GetMatrix |
|||
| syntax: NDB_GetMatrix | |||
|
|||
| returns: nothing | |||
| Comments: Some Newton functions return an entire matrix. These functions, when called by the wrapper, will fill the temp matrix with the return data. To access this data in DBPro, call this function. It will fill all 4 internal vectors with the matrix data. Then use the NDB_GetVector_X(), NDB_GetVector_Y(), NDB_GetVector_Z(), NDB_GetVector_W() commands to access the individual values. Vector 1 = top row -> Vector 4 = position row. | |||
|
NDB_GetMatrix fill temp vectors with
matrix data. posx# = NDB_GetVector_X(4) get the x position stored in the matrix. |
NDB_SetMatrix |
|||
| syntax: NDB_SetMatrix | |||
|
|||
| returns: nothing | |||
| Comments: This function fills the matrix with the Temp vector data. |
NDB_BuildMatrix |
||||||||||||||||||
| syntax: NDB_BuildMatrix [ rx, ry, rz, tx, ty, tz ] | ||||||||||||||||||
|
||||||||||||||||||
| returns: nothing | ||||||||||||||||||
| Comments: This is a utility command that builds a matrix in one simple command. You pass it the rotation information (in degrees) along with the translation information, and it fills the internal temp matrix. This can make setting up rigid bodies and ragdoll bones much simpler. If no values are passed, the function uses the contents of temp vector 1 for the rotation values, and the contents of temp vector 2 for the position data. | ||||||||||||||||||
|
build a matrix with rotation (x = 90,y = 0,z = 0) and position (x = 15,y = 10,z
= 0): NDB_BuildMatrix 90.0, 0.0, 0.0, 15.0, 10.0, 0.0 |
NDB_NormalizeVector |
|||
| syntax: NDB_NormalizeVector [vec_num] | |||
|
|||
| returns: nothing. | |||
| Comments: normalizes the specified vector into a unit vector. If no vector is specified, temp vector 1 is assumed. |
NDB_RotateVector |
|||
| syntax: NDB_RotateVector [vec_num] | |||
|
|||
| returns: nothing. | |||
|
Comments: Rotates the specified vector by the rotation matrix ( the temp matrix is used, setup a rotation matrix with the NDB_BuildMatrix command ). (ROTATION)
v 1.31 |
NDB_UnrotateVector |
|||
| syntax: NDB_UnrotateVector [vec_num] | |||
|
|||
| returns: nothing. | |||
|
Comments: un-rotates the specified vector by the rotation matrix ( the temp matrix is used, setup a rotation matrix with the NDB_BuildMatrix command ). See comments above for more in depth explanation. v 1.31 |
NDB_TransformVector |
|||
| syntax: NDB_TranslateVector [vec_num] | |||
|
|||
| returns: nothing. | |||
|
Comments: translates the specified vector by the rotation matrix ( the temp matrix is used, setup a rotation matrix with the NDB_BuildMatrix command ). See comments above for more in depth explanation. v 1.31 |
NDB_UntransformVector |
|||
| syntax: NDB_UntranslateVector [vec_num] | |||
|
|||
| returns: nothing. | |||
|
Comments: un-translates the specified vector by the rotation matrix ( the temp matrix is used, setup a rotation matrix with the NDB_BuildMatrix command ). See comments above for more in depth explanation. v 1.31 |
NDB_SetStandardGravity |
|||
| syntax: NDB_SetStandardGravity | |||
|
|||
| returns: nothing | |||
| Comments: Sets the standard gravity to be used if a specific gravity is not specified for a body. This force will only be applied if the NDB_BodySetGravity command is called for the body. See that command for more details. | |||
|
NDB_SetVector 0.0, -9.8, 0.0 NDB_SetStandardGravity - sets standard acceleration due to gravity to -9.8 units / second. |
NDB_GetStandardGravity |
|||
| syntax: NDB_GetStandardGravity | |||
|
|||
| returns: nothing | |||
| Comments: Fills temp vector 1 with the Standard gravity set for the world. This force will only be applied if the NDB_BodySetGravity command is called for the body. See that command for more details. |
NDB_SetStandardLiquid |
||||||||||||
| syntax: NDB_SetStandardLiquid f_density, l_visc, a_visc | ||||||||||||
|
||||||||||||
| returns: nothing | ||||||||||||
| Comments: Sets the standard values for buoyancy forces, describing the density and viscosity of the liquid. make sure to fill temp vector 1 with the gravitational vector for the liquid as well. |
NDB_GetStandardLiquid |
||||||
| syntax: NDB_GetStandardLiquid | ||||||
|
||||||
| returns: nothing | ||||||
|
Comments: returns the standard liquid settings for the world. like so: temp vector 1 |
NDB_CalculateMISphereSolid |
|||||||||
| syntax: NDB_CalculateMISphereSolid mass, radius | |||||||||
|
|||||||||
| returns: nothing | |||||||||
| Comments: Fills temp vector 1 with the Moment of Inertia for a Solid Sphere of the specified size. You can plug these values into the NDB_NewtonBodySetMassMatrix function to achieve more realistic rigid body simulation. |
NDB_CalculateMISphereHollow |
|||||||||
| syntax: NDB_CalculateMISphereHollow mass, radius | |||||||||
|
|||||||||
| returns: nothing | |||||||||
| Comments: Fills temp vector 1 with the Moment of Inertia for a Hollow Sphere of the specified size. You can plug these values into the NDB_NewtonBodySetMassMatrix function to achieve more realistic rigid body simulation. |
NDB_CalculateMIBoxSolid |
|||||||||||||||
| syntax: NDB_CalculateMIBoxSolid mass [, width, height, depth] | |||||||||||||||
|
|||||||||||||||
| returns: nothing | |||||||||||||||
| Comments: Fills temp vector 1 with the Moment of Inertia for a Solid Box of the specified size. If no size is specified, the contents of temp vector 1 are used. You can plug these values into the NDB_NewtonBodySetMassMatrix function to achieve more realistic rigid body simulation. If no initial size is specified, the contents of temp vector 1 are used. |
NDB_CalculateMICubeSolid |
|||||||||
| syntax: NDB_CalculateMICubeSolid mass, size | |||||||||
|
|||||||||
| returns: nothing | |||||||||
| Comments: Fills temp vector 1 with the Moment of Inertia for a Solid Cube of the specified size. You can plug these values into the NDB_NewtonBodySetMassMatrix function to achieve more realistic rigid body simulation. |
NDB_CalculateMICylinderSolid |
||||||||||||
| syntax: NDB_CalculateMICylinderSolid mass, radius, height | ||||||||||||
|
||||||||||||
| returns: nothing | ||||||||||||
| Comments: Fills temp vector 1 with the Moment of Inertia for a Solid Cylinder of the specified size. You can plug these values into the NDB_NewtonBodySetMassMatrix function to achieve more realistic rigid body simulation. NOTE - the cylinder is assumed to be aligned standing on the X axis. in other words, the height value refers to the X axis of the object, and the radius value refers to the Y and Z axis. |
NDB_GetCollisionBodyToBody |
||||||
| syntax: int = NDB_GetCollisionBodyToBody( body1, body2 ) | ||||||
|
||||||
| returns: index to the collision data (0 if no collision) | ||||||
| Comments: The wrapper will record collision data for any 2 materials you set. Use this command to check it two bodies (presumably of the materials you set) have collided. The function will return an integer > 0 if there has been a collision. pass this integer into the NDB_GetCollisionDatafunction to retrieve detailed collision data. |
NDB_GetCollisionBodyToMaterial |
||||||
| syntax: int = NDB_GetCollisionBodyToMaterial( body, materialID ) | ||||||
|
||||||
| returns: index to the collision data (0 if no collision) | ||||||
| Comments: The wrapper will record collision data for any 2 materials you set. Use this command to check if a rigid body and any bodies of the other material have collided. The function will return an integer > 0 if there has been a collision. pass this integer into the NDB_GetCollisionDatafunction to retrieve detailed collision data, including the 2nd body involved in the collision, through the NDB_GetCollisionBody. |
NDB_GetCollisionData |
|||
| syntax: NDB_GetCollisionData index | |||
|
|||
| returns: nothing | |||
| Comments: this will fill the temp vectors with
detailed information about the collision found by the NDB_GetCollision
command. Data returned: temp vector 1 [x,y,z] - position of the collision in global space. temp vector 2 [x,y,z] - normal vector of the collision. temp vector 2 [w] - speed of collision along normal vector. temp vector 3 [x,y,z] - first tangent vector of the collision. temp vector 3 [w] - speed of collision along first tangent vector. temp vector 4 [x,y,z] - second tangent vector of the collision. temp vector 4 [w] - speed of collision along second tangent vector. |
NDB_GetCollisionBody |
||||||
| syntax: body = NDB_GetCollisionBody( index, body ) | ||||||
|
||||||
| returns: nothing | ||||||
| Comments: this will return the index to a body involved in the collision. You can get the bodies involved in the collision by passing a 1 or 2 into the second parameter of the function. |
NDB_DebugDrawNewtonLines |
| syntax: NDB_DebugDrawNewtonLines |
| returns: nothing. |
|
Comments: This command allows the user to see the actual Rigid Body data according to Newton. This is helpful for debuggin purposes, as you can confirm where exactly each rigid body is in the scene. It's also helpful for debugging ragdolls and vehicles, as it allows you to visualize the actual bone / wheel data. This command uses 2D lines to draw the polygons that make up the rigid bodies. Newton supports multi-sided faces (quads, etc), which DBPro doesn't support. The other debug command, NDB_DebugMakeNewtonObject has to turn all faces into triangles, which means it's not as accurate as this 2D version. the trade-off is that this version has no backface culling, and is slower than the model version. |
NDB_DebugMakeNewtonObject |
|||
| syntax: obj = NDB_DebugMakeNewtonObject(flag) | |||
|
|||
|
returns: Nothing. |
|||
|
Comments: This command allows the user to see the actual Rigid Body data
according to Newton. This is helpful for debuggin purposes, as you can confirm
where exactly each rigid body is in the scene. It's also helpful for debugging
ragdolls and vehicles, as it allows you to visualize the actual bone / wheel
data. This command creates a new object, with all of the rigid bodies in the
entire Newton world. It is basically a "snapshot in time" of the Newton system
at the given moment. The object defaults to wireframe drawing mode. In order to
watch the Newton world in realtime, you must delete this object, and generate a
new one for each frame. Alternatively, you can save each object, and then later
go back and examine the various time steps very closely. This method is much
faster than the NDB_DebugDrawNewtonLines
method, but is not as accurate, because it turns 4+ sided faces into triangles
(for DBPro rendering). .
|
NDB_DebugRigidBodyCount |
| syntax: int = NDB_DebugRigidBodyCount() |
|
returns: integer value of number of rigid bodies in world. |
|
Comments: This is a general debug function that returns the total number of Rigid Bodies in the Newton world. This method is not particularly optimized, and it intended for debug use only. |