By Walaber
All Coding between 1.31-1.32B by Kjelle
Updated to 1.53 by Tiresius
NDB_NewtonCreateNull |
|||
| syntax: int = NDB_NewtonCreateNull() | |||
|
|||
| returns: integer index to the collision data created. | |||
|
Comments: Makes a null collision object. Null objects will never colide with anything, but exist for special cases when you need a "space filler". |
|||
| col = NDB_NewtonCreateNull() make null collision data, and store the index to it in the variable "col" |
NDB_NewtonCreateSphere |
||||||
| syntax: int = NDB_NewtonCreateSphere( rad [ ,matrix_flag ] ) | ||||||
|
||||||
| returns: integer index to the collision data created. | ||||||
| Comments:Newton rigid bodies are made from collision data. The simplest way to make collision data is to use the built-in primitives. If you want the collision data offset from the origin of the body, set the data into the temp matrix, and then add a ",1" flag to the command. No flag assumes the collision data will be centered at the origin of the body. | ||||||
| col = NDB_NewtonCreateSphere( 2.0 ) make collision data of a sphere with radius 2.0, and store the index to it in the variable "col" |
NDB_NewtonCreateBox |
||||||||||||
| syntax: col = NDB_NewtonCreateBox( [x, y, z, matrix_flag] ) | ||||||||||||
|
||||||||||||
| returns: integer index to the collision data created. | ||||||||||||
| Comments: Makes collision data of a simple box. If you don't supply the x,y,z values, the wrapper automatically uses the contents of temp vector 1. If you want the collision data offset from the origin of the body, set the data into the temp matrix, and then add a ",1" flag to the command. No flag assumes the collision data will be centered at the origin of the body. | ||||||||||||
|
col = NDB_NewtonCreateBox( 10.0, 2.0, 2.0 )
create collision data of a box with dimensions x=10 y=2 z=2 centered on the
origin. col = NDB_NewtonCreateBox( 1 ) create collision data of a box with dimensions stored in temp vector 1, and offset based on contents of temp matrix. |
NDB_NewtonCreateCylinder |
|||||||||
| syntax: int = NDB_NewtonCreateCylinder( rad, height [ ,matrix_flag ] ) | |||||||||
|
|||||||||
| returns: integer index to the collision data created. | |||||||||
|
Comments:Makes a primitive cylinder object. Cylinders are by default aligned with the height along the x-axis. Call this function with a flag of ",1" to apply an offset matrix to the collision data. |
|||||||||
| col = NDB_NewtonCreateCylinder( 2.0, 5.0 ) make collision data of a cylinder with radius 2.0 height 5.0, and store the index to it in the variable "col" |
NDB_NewtonCreateChamferCylinder |
|||||||||
| syntax: int = NDB_NewtonCreateChamferCylinder( rad, height [ ,matrix_flag ] ) | |||||||||
|
|||||||||
| returns: integer index to the collision data created. | |||||||||
|
Comments:Makes a primitive chamfer cylinder object. Chamfer Cylinders are by default aligned with the height along the x-axis. Call this function with a flag of ",1" to apply an offset matrix to the collision data. |
|||||||||
| col = NDB_NewtonCreateChamferCylinder( 2.0, 5.0 ) make collision data of a chamfer cylinder with radius 2.0 height 5.0, and store the index to it in the variable "col" |
NDB_NewtonCreateCapsule |
|||||||||
| syntax: int = NDB_NewtonCreateCapsule( rad, height [ ,matrix_flag ] ) | |||||||||
|
|||||||||
| returns: integer index to the collision data created. | |||||||||
|
Comments:Makes a primitive capsule object. Capsules are by default aligned with the height along the x-axis. Call this function with a flag of ",1" to apply an offset matrix to the collision data. |
|||||||||
| col = NDB_NewtonCreateCapsule( 2.0, 5.0 ) make collision data of a capsule with radius 2.0 height 5.0, and store the index to it in the variable "col" |
NDB_NewtonCreateCone |
|||||||||
| syntax: int = NDB_NewtonCreateCone( rad, height [ ,matrix_flag ] ) | |||||||||
|
|||||||||
| returns: integer index to the collision data created. | |||||||||
|
Comments:Makes a primitive cone object. Cones are by default aligned with the height along the x-axis. Call this function with a flag of ",1" to apply an offset matrix to the collision data. |
|||||||||
| col = NDB_NewtonCreateCone(12.0, 3.0 ) make collision data of a capsule with radius 12.0 height 3.0, and store the index to it in the variable "col" |
NDB_NewtonCreateConvexHull |
||||||
| syntax: int = NDB_NewtonCreateConvexHull( obj_num [ ,matrix_flag ] ) | ||||||
|
||||||
| returns: integer index to the collision data created. | ||||||
|
Comments: Makes a convex hull primitive. Convex Hulls take a set of vertices, and "wrap" it, making the smallest possible convex shape that includes all of the vertices. Imagine wrapping an odd-shaped item in wrapping paper, and that's basically what it does. This command uses all of the vertices in the supplied object to create the collision. |
||||||
|
load object "boulder.x", 10 |
NDB_NewtonCreateCompoundCollision |
|||
| syntax: col = NDB_NewtonCreateCompoundCollision | |||
|
|||
| returns: integer index to the collision data created. | |||
| Comments: Compound Collision is collision data based
on several collision primitives. For example using 4 box primitives to
represent a picture frame. CAUTION you MUST follow the following step to make compound collion data: call the function NDB_StartCompoundCollision. Then, for each primitive:
Make your rigid body as normal with the NDB_NewtonCreateBody command. |
NDB_StartCompoundCollision |
|||
| syntax: NDB_StartCompoundCollision | |||
|
|||
| returns: nothing. | |||
|
Comments: This command clears the wrapper's internal array of Newton Collision objects, for creating CompoundCollision objects. you must call this command before starting a new compound collision object. To add collisions to the array, use the NDB_AddCollisionToArray command. . |
NDB_AddCollisionToArray |
|||
| syntax: NDB_AddCollisionToArray col | |||
|
|||
| returns: nothing. | |||
|
Comments: This command adds the supplied Newton Collision data into the next slot in the collision array, for creating CompoundCollision objects. After adding all collision objects to the array, call the NDB_NewtonCreateCompoundCollision. Before adding the first collision to the array, make sure you call the NDB_StartCollisionArray command. |
NDB_NewtonCreateTreeCollision |
||||||
| syntax: col = NDB_NewtonCreateTreeCollision( [db_num, limb flag] ) | ||||||
|
||||||
| returns: integer index to the collision data created. | ||||||
|
Comments: Newton supports mesh-based collision. However objects made from mesh collision automatically have infinite mass, making them immobile. These objects are good for backgrounds, terrains, buildings, etc.
|
||||||
|
load object "terrain.x", 100 load an
object like normal. col = NDB_NewtonCreateTreeCollision( 100 ) make collision data based on this object's polygon data. |
NDB_NewtonCreateTreeCollisionUnOptimized |
||||||
| syntax: col = NDB_NewtonCreateTreeCollisionUnOptimized( [db_num, limb flag] ) | ||||||
|
||||||
| returns: integer index to the collision data created. | ||||||
|
Comments: Same as above but no Optimization. |
NDB_NewtonTreeCollisionBeginBuild |
|||
| syntax: NDB_NewtonTreeCollisionBeginBuild col | |||
|
|||
| returns: nothing. | |||
|
Comments: This command tells Newton you are about to add faces (polygon data) to an empty Tree Collision object. To use this manual method you must have created an empty TreeCollision object by calling NDB_NewtonCreateTreeCollision with no parameters. |
NDB_NewtonTreeCollisionAddFace |
||||||
| syntax: NDB_NewtonTreeCollisionAddFace col | ||||||
|
||||||
| returns: nothing. | ||||||
|
Comments: This command adds a face to the Tree Collision object. Before calling this command, you must place the local location of the 3 vertices that make up the polygon into temp vectors 1-3. You must have called NDB_NewtonTreeCollisionBeginBuild before calling this command. |
NDB_NewtonTreeCollisionEndBuild |
||||||
| syntax: NDB_NewtonTreeCollisionEndBuild col, flag | ||||||
|
||||||
| returns: nothing. | ||||||
|
Comments: This command completes a TreeCollision object, making it ready to be used by the NDB_NewtonCreateBody command. a flag of "1" tells Newton to optimize the collision data for more efficient behavior. This is highly recommended, as optimized objects run much faster. |
NDB_NewtonCreateTreeCollisionFromSerialization |
|||
| syntax: col = NDB_NewtonCreateTreeCollisionFromSerialization( filename ) | |||
|
|||
| returns: integer index to the collision data created. | |||
| Comments: This command allows the user to load previously saved TreeCollision data, instead of creating it from object geometry. This is MUCH faster than building tree collision data live. | |||
| col = NDB_NewtonCreateTreeCollisionFromSerialization( "serial.dat" ) |
NDB_NewtonTreeCollisionSerialize |
||||||
| syntax: NDB_NewtonTreeCollisionSerialize col, filename | ||||||
|
||||||
| returns: nothing | ||||||
| Comments: This command saves a previously built TreeCollision into a compiled data file, which can then be loaded at runtim with the NDB_NewtonCreateTreeCollisionFromSerialization command above.. | ||||||
| NDB_NewtonCreateTreeCollisionFromSerialization col, "serial.dat" |
NDB_NewtonReleaseCollision |
|||
| syntax: NDB_NewtonReleaseCollision col | |||
|
|||
| returns: nothing. | |||
|
Comments: Collision objects are reference counted objects. The application should call NewtonReleaseCollision in order to release references to the object. Neglecting to release references to collision primitives is a common cause of memory leaks. |
NDB_NewtonCreateConvexHullWithScale |
||||||
| syntax: NDB_NewtonCreateConvexHullWithScale(db_obj) | ||||||
|
||||||
| returns: nothing. | ||||||
|
Comments: Uses temp vector 1 as a scalar for the convex hull. use if you're scaling your DBPro objects after loading. |
NDB_NewtonCreateTreeCollisionWithScale |
|||||||||
| syntax: NDB_NewtonCreateTreeCollisionWithScale( [db_num, limb flag] ) | |||||||||
|
|||||||||
| returns: nothing. | |||||||||
|
Comments: Uses temp vector 1 as a scalar for the TreeCollision. use if you're scaling DBPro objects after loading. |
NDB_NewtonCreateTreeCollisionWithScaleUnoptimized |
|||||||||
| syntax: NDB_NewtonCreateTreeCollisionWithScaleUnoptimized( [db_num, limb flag] ) | |||||||||
|
|||||||||
| returns: nothing. | |||||||||
|
Comments: Same as above, but no optimization. |
NDB_NewtonCreateConvexHullModifier |
|||
| syntax: NDB_NewtonCreateConvexHullModifier( col ) | |||
|
|||
| returns: nothing. | |||
|
Comments: Makes a copy of an existing collision, which can then be scaled in realtime using the commands below. (NDB_NewtonConvexHullModifierSetMatrix and NDB_BuildScaleMatrix) |
NDB_NewtonConvexHullModifierSetMatrix |
|||
| syntax: NDB_NewtonConvexHullModifierSetMatrix( col ) | |||
|
|||
| returns: nothing. | |||
|
Comments: Sets the scale matrix for the modifier. Use the new NDB_BuildScaleMatrix command to build the actual matrix. |
NDB_NewtonConvexHullModifierGetMatrix |
|||
| syntax: NDB_NewtonConvexHullModifierGetMatrix( col ) | |||
|
|||
| returns: nothing. | |||
|
Comments: Fills temp matrix with the current scale matrix for the collision. |
NDB_BuildScaleMatrix |
|||
| syntax: NDB_BuildScaleMatrix sx, sy, sz | |||
|
|||
| returns: nothing. | |||
|
Comments: Builds a simple scale matrix, for use with the above commands. |
NDB_NewtonConvexCollisionCalculateInertialMatrix |
|||||||||
| syntax: NDB_NewtonConvexCollisionCalculateInertialMatrix col | |||||||||
|
|||||||||
| returns: nothing. | |||||||||
|
Calculate the three principal axis and the the values of the inertia matrix of a convex collision objects. Comments: |
NDB_NewtonConvexCollisionCalculateVolume |
|||
| syntax: vol = NDB_NewtonConvexCollisionCalculateVolume( col ) | |||
|
|||
| returns: collision geometry volume (float). This function will return zero if the body collision geometry is not convex. | |||
|
Remarks: |