Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8700228
  • 博文数量: 1413
  • 博客积分: 11128
  • 博客等级: 上将
  • 技术积分: 14685
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-13 10:03
个人简介

follow my heart...

文章分类

全部博文(1413)

文章存档

2013年(1)

2012年(5)

2011年(45)

2010年(176)

2009年(148)

2008年(190)

2007年(293)

2006年(555)

分类:

2006-11-26 19:18:06

3Impact engine uses a left-handed coordinate system. X and Z axes define an horizontal
plane. When looking from the origin toward +Z, +Y points upward and +X to your right.

For clarity, we have named all functions adopting the following rules:
* function name starts with 'i'
* the first word (or words) after the 'i' is the object the function refers to. For
  example, in 'iCameraCreate', 'Camera' is the object of the function.
* the subsequent word (or words) is the action performed on the object. For
  example, in 'iCameraCreate', 'Create' is the action performed on the camera.
  If no action word is provided, it's very likely that the function will just return
  some information regarding the object, like for example iCameraLocation().

Some functions require quantities to be passed as parameters. Keep in mind as follows:
* time is in seconds.
* linear quantities are in meters.
  In particular, velocity is in meters-per-second, acceleration is in
  meters-per-(seconds^2).
* angular quantities are in degrees.
  In particular, spin is in degrees-per-second, angular acceleration is in
  degrees-per-(seconds^2).

File paths are local. For example "sprites\\cursor.x" refers to a file named 'cursor.x'
stored inside a folder named 'sprites', which is inside the currently executed .dll folder.
However, you can specify absolute paths like "C:\\myfolder\\myfile.ext" if needed.
Paths like "..\\myfolder\\myfile.ext" are also valid.

Some function parameters are marked as 'Return data' in this reference. It means that the
parameter is a pointer to a structure (data memory block) that you are supposed to provide,
and that the associated memory block will be filled with return data when the function
returns after the call.

When making your own 3d models, before exporting to .x, make sure that your model:
* is made of triangles only. Any quad or superior polygon must be split to triangles.
  Most modelers provide a 'triangulate' function.
* has all triangles texture-mapped by using one single texture.
  The texture image must be power-of-two sized. For example 256x256, 512x256, 128x1024, etc.
  The image must also be a .bmp, .dds, .dib, .jpg, .png or .tga file.
* does not include isolated vertices, degenerated faces, etc.
* does not include cameras, lights, hierarchies, bones, joints, or any other alien,
  modeler specific, data.
Also, make sure that texture mapping, material and vertex normal data are actually exported
to the destination .x file, and that the companion texture image file is present in the
destination folder with the .x file.

When making your own 3d models, keep in mind that:
* the world center in your modeler will be the so called 'source-model-center' when the 3d
  model is imported to 3Impact space. It is used as a reference by many functions, like for
  example iBodyLocationSet().
* the so called 'center-of-mass' is, automatically assigned by the engine on body creation.
  It is another reference point used by some functions, like for example iBodyLocationCMSet().

**********************************************************************************************
CAMERA
**********************************************************************************************

CAMERA* iCameraCreate(int,int,int,int);
   Add a point of view. A 3d project always needs at least one camera.
   Basically, a camera is a rendering window opened on the screen.
   Return camera object.
   int,int = location of top/left corner of camera window, on the screen.
             The two coordinates must be between 0 and 100, where
             0,0 is top/left screen corner and 100,100 is bottom/right screen corner.
   int,int = width and height of camera window.
             Both parameters must be between 1 and 100, where 100 means full width/height.

void iCameraSet(CAMERA*,int,int,int,int);
   Change specified camera window position and size, on the screen.
   See iCameraCreate() for details.
   CAMERA* = camera object.

void iCameraDestroy(CAMERA*);
   CAMERA* = camera object to destroy.
             Note that destroying camera objects is not necessary because the engine will
             do it automatically on exit.

void iCameraOrientation(CAMERA*,D3DXQUATERNION*);
   CAMERA* = camera object
   D3DXQUATERNION* = orientation. Return data.

void iCameraLocation(CAMERA*,D3DXVECTOR3*);
   CAMERA* = camera object
   D3DXVECTOR3* = 3d location. Return data.

void iCameraAutoWipeSet(CAMERA*,int);
   Set automatic wipe mode of camera window before the rendering of every frame.
   CAMERA* = camera object
   int = wipe mode
         0 = wipe nothing
         1 = wipe graphics only
         2 = wipe depth-buffer only
         3 = wipe both graphics and depth-buffer (default)

void iCameraSpritesOnlySet(CAMERA*,BOOL);
   CAMERA* = camera object
   BOOL = whether to exclude from rendering all objects except sprites and texts.
          TRUE enables sprite-text-only mode. Default is FALSE.
         
void iCameraFovSet(CAMERA*,float);
   CAMERA* = camera object
   float = field of view (FOV), in degrees. Default 60.0f.
           Fov is basically the zoom effect. The smaller the fov angle, the bigger
           the zoom effect.

float iCameraFov(CAMERA*);
   Return specified camera field of view, in degrees.
   CAMERA* = camera object

void iCameraClipDistanceSet(CAMERA*,float);
   CAMERA* = camera object
   float = clip distance. Default 10000.0f.
           Objects farther than the clip distance will not be rendered.

void iCameraEulerOrientationSet(CAMERA*,float,float,float,char*);
   CAMERA* = camera object
   float = rotation about X axis
   float = rotation about Y axis
   float = rotation about Z axis
   char* = 3-character string specifying the order in which to apply the rotations.
           For example, "xyz" (apply rotation about X first, followed by Y and Z),
           and "xzy" are valid strings.

void iCameraOrientationSet(CAMERA*,D3DXQUATERNION*);
   CAMERA* = camera object
   D3DXQUATERNION* = quaternion specifying an orientation.

void iCameraLocationSet(CAMERA*,D3DXVECTOR3*);
   CAMERA* = camera object
   D3DXVECTOR3* = 3d location

void iCameraVelocitySet(CAMERA*,D3DXVECTOR3*);
   CAMERA* = camera object
   D3DXVECTOR3* = camera velocity.
   NOTE: camera velocity is used only to compute Doppler effect. You don't have to
   update camera velocity by calling this function, if Doppler factor is 0.0f.
   See iListenerDopplerSet() for more.

void iCameraLookAt(CAMERA*,D3DXVECTOR3*,float);
   CAMERA* = camera object
   D3DXVECTOR3* = 3d location, in meters.
                  The camera is smoothly orientated toward the specified 3d location.
   float = camera quickness factor, from 0.0f to 1.0f.

**********************************************************************************************
LIGHT
**********************************************************************************************

void iLightDirectionalSet(D3DXVECTOR3*,D3DXVECTOR4*);
   D3DXVECTOR3* = light direction
   D3DXVECTOR4* = pointer to a 4-vector structure specifying the light color.
                  The first 3 parameters are Red, Green and Blue components respectively.
                  The fourth parameter is the amount of minimal light. The minimal
                  light is the light reflected by the dark-side of the objects.
                  Zero minimal light causes dark-side of objects to be completely black.
                  1.0f minimal light causes them to be as bright as the illuminated side
                  of objects.

void iLightLocalLocationSet(int,D3DXVECTOR3*);
   int = light number (from 0 to 2).
         NOTE: only meshes enabled with iMeshLocalLightsEnable() will be affected by local lights.
   D3DXVECTOR3* = 3d location

void iLightLocalColorSet(int,D3DXVECTOR4*);
   Set local light properties.
   int = light number (from 0 to 2).
         NOTE: only meshes enabled with iMeshLocalLightsEnable() will be affected by local lights.
   D3DXVECTOR4* = pointer to a 4-vector structure specifying a the color of the light.
                  The first 3 parameters are Red, Green and Blue components respectively.
                  The fourth parameter is the rate of light intensity reduction. The bigger
                  the factor, the smaller the distance reached by the light.

**********************************************************************************************
SKYBOX
**********************************************************************************************

SKYBOX* iSkyBoxCreate(char*);
   Return skybox object.
   char* = source .sky file name. You can generate .sky files as follows:
           (1) in your modeler create a 2 meters wide cube.
           (2) center the model respect to world origin.
           (3) flip all faces inward so that they are visible from world origin.
           (4) you will need a special scene rendering software to generate so
               called 'skybox textures'. They are basically six different image
               files representing a scenery as seen from six 90-degrees-fov cameras
               placed at the origin and oriented respectively toward +X,-X,+Y,-Y,+Z,-Z.
           (5) Apply each texture to each cube face. +X texture to +X face, -X texture
               to -X face, +Y texture to +Y face, and so on.
           (6) save the model to six different .x files, so that each file contains only
               one face of the original cube.
               The file name of each model must be in the form 'name_XX.x', where XX can be
               'px' (positive X face), 'nx' (negative X face),
               'py' (positive Y face), 'ny' (negative Y face),
               'pz' (positive Z face), 'nz' (negative Z face).
           (7) run 3Impact Converter and select 'Generate skybox...' option.
           (8) select one of the 'name_XX.x' file and perform the conversion to generate
               a .sky file.
   NOTE: skyboxes are hide when they are created. You can show them with iSkyBoxShow().

void iSkyBoxDestroy(SKYBOX*);
   SKYBOX* = skybox object
             Note that destroying skybox objects is not necessary because the engine will
             do it automatically on exit.

void iSkyBoxHide(SKYBOX*);
   SKYBOX* = skybox object

void iSkyBoxShow(SKYBOX*);
   SKYBOX* = skybox object

void iSkyBoxColorSet(SKYBOX*,float,float,float);
   SKYBOX* = skybox object
   float = red (0.0f to 1.0f)
   float = green (0.0f to 1.0f)
   float = blue (0.0f to 1.0f)

void iSkyBoxEnvMapCasterAdd(SKYBOX*);
   SKYBOX* = skybox object to be added to the list of skyboxes that are reflected by
             dynamic environment surfaces. See iEnvMapUpdateRateSet() for more.

**********************************************************************************************
BODY
**********************************************************************************************

BODY* iBodyCreate(char*);
   Return polyhedron-based body object.
   char* = source .ply file name.
           The .ply is derived from polygonal geometry to be used as a reference when
           computing collision detection. Such a geometry is not rendered, however
           a texture mapped 3d model is typically associated to the body, in order
           to visualize it. There is no need for the invisible and the visible geometry to
           match, but you will typically model the invisible geometry so that it closely
           matches at least those parts of the visible mesh that are supposed to collide
           with other objects
           You can generate .ply (polyhedron-based, static body) files as follows:
           (1) in your modeler create a polygonal model with no textures.
           (2) if you plan to perform different restitution and friction effects, depending
               on what triangles of the model are involved in a collision, in your 3d modeler
               assign different materials to each part of the model. Each part will be seen
               as a sub-part (SUBPART*) by the engine.
           (3) save the model as an .x file with a name like 'name_R.x', where R is a
               value specifying a 'resolution' in meters. In order to speed up collision
               detection computation, the engine will 'split' the model to a number of parts,
               approximately the size of the specified resolution. As a general rule, resolution
               value should be about the size of an average sphere (dynamic bodies), among those
               involved in the collision. Examples of valid names are 'name_5.x', 'name_7.23.x'.
           (4) run 3Impact Converter and select 'Generate polyhedron-based body...' option.
           (5) select the source 'name_X.x' file and perform the conversion to generate
               a .ply file. note that a companion .pol file is generated along with it.
   NOTE: bodies are disabled when they are created. You can enable them with iBodyEnable().

BODY* iBodySGCreate(char*,float);
   Return sphere-group-based body object.
   char* = source .spg file name.
           The .spg file is derived from two meshes. The first one must be a group of
           polygonal spheres to be used as a reference when computing collision detection.
           The second must be a group of polygonal closed hulls to be used as a reference
           to compute mass distribution (mass properties) to properly process dynamics behavior.
           Both geometries are not rendered, however a texture mapped polygonal model is
           typically associated to the body, in order to visualize it.
           You can generate .spg (sphere-group-based, dynamic body) files as follows:
           (1) in your modeler create an object made of polygonal spheres only, with no textures.
               Note that processing time for collision detection is proportional to the number
               of spheres. The rule is trying to keep the number of spheres as small as possible.
               Also, note that the number of faces for this model must not exceed 65536.
           (2) save the model as an .x file with a name like 'name_.x'. An '_' (underscore)
               must precede the dot.
           (3) in your modeler create a polygonal object made of closed hulls, with no textures.
               Note that the number of vertices for this model must not exceed 10000.
           (4) save the model as an .x file with a name like 'name__.x'. Two '__' (underscores)
               must precede the dot. 'name' must be the same used for the previous .x file.
           (5) run 3Impact Converter and select 'Generate sphere-group-based body...' option.
           (6) select the source 'name_.x' file (the one with one single underscore) and
               perform the conversion to generate an .spg file.
   float = total mass. As a reference, total mass for one liter of water is about 1.0f.
           Setting a total mass too small may cause unpredictable behaviors, including
           severe processing slowdown.
   NOTE: bodies are disabled when they are created. You can enable them with iBodyEnable().

BODY* iBodySphereCreate(float,float);
   Return sphere-group-based body object. It is a sphere group made of one
   single sphere with specified mass and radius.
   float = radius
   float = total mass. See iBodySGCreate()

void iBodyDestroy(BODY*);
   BODY* = body object
           Note that destroying body objects is not necessary because the engine will
           do it automatically on exit.

void iBodyMassSet(BODY*,float);
   BODY* = body object. Must be sphere-group based.
   float = total mass. See iBodySGCreate().

MESH* iBodyMeshCreate(char*,BODY*);
   Return mesh object.
   Bodies are 'solid' but invisible. Attaching meshes to them is usually necessary
   to show them. This function creates a mesh and attach it to the specified body.
   Multiple meshes can be created and attached to the same body by calling this
   function multiple times.
   char* = source .x file name.
           See iMeshCreate() to know how to generate proper .x files.
   BODY* = body to attach the mesh to.
           Destination body can be either polyhedron-based or sphere-group-based.
   NOTE: meshes are hide when they are created. You can show them with iMeshShow().

void iBodyDampingSet(BODY*,float,float,float,float);
   Damping is a technique used to limit the 'energy' of a body (extremely high speed,
   extremely fast spinning, etc), in order to minimize improper simulation behaviors.
   Damping tend to disrupt simulation realism, so it's all about finding the balance
   between damping amount and simulation realism.
   BODY* = body object
   float = maximum speed beyond which linear damping is applied.
   float = linear damping factor (reduction-per-second, between 0.0f and 1.0f).
           It is like multiplying the current amount by the specified factor, every second.
   float = maximum spin beyond which angular damping is applied.
   float = angular damping factor (reduction-per-second, between 0.0f and 1.0f).
           It is like multiplying the current amount by the specified factor, every second.
   NOTE: if speed or spin are bigger than specified limits, they are multiplied by damping
   factors. It means that if damping factor is 1.0f, no damping is applied. If it is 0.0f,
   velocity and spin are immediately set to zero (the body stops immediately traveling or
   spinning as soon as the speed/spin limit is reached). Typical damping factor is 0.25f.
   By default, bodies perform no damping.

void iBodyDirectionalLinearDampingSet(BODY*,float,float,float,float);
   BODY* = body object
   float = maximum speed (in meters-per-second) beyond which linear damping is applied.
   float = linear damping factor (reduction-per-second, between 0.0f and 1.0f), X axis.
   float = linear damping factor (reduction-per-second, between 0.0f and 1.0f), Y axis.
   float = linear damping factor (reduction-per-second, between 0.0f and 1.0f), Z axis.
   NOTE: 'directional-linear' means that you can set a different damping factor for
   each body-relative axis (local XYZ).
   NOTE: setting linear directional damping excludes normal linear damping and vice-versa.

void iBodyDirectionalAngularDampingSet(BODY*,float,float,float,float);
   BODY* = body object
   float = maximum spin (in meters-per-second) beyond which linear damping is applied.
   float = angular damping factor (reduction-per-second, between 0.0f and 1.0f), X axis.
   float = angular damping factor (reduction-per-second, between 0.0f and 1.0f), Y axis.
   float = angular damping factor (reduction-per-second, between 0.0f and 1.0f), Z axis.
   NOTE: directional means that you can set a different damping factor for each body-relative
   axis of rotation (local XYZ).
   NOTE: setting angular directional damping excludes normal angular damping and vice-versa.

int iBodySphereCount(BODY*);
   Return total number of sub-parts (spheres) forming the specified body.
   BODY* = body object (must be sphere-group-based)

SUBPART* iBodySphere(BODY*,int);
   Return sub-part (sphere) object.
   BODY* = body object (must be sphere-group-based)
   int = sub-part (sphere) index.
         Defines the sphere object to return as sub-part object.
         The first sphere in the group has index = 0,
         the second = 1, and so on.

void iBodyDisable(BODY*);
   BODY* = body object
           Collision detection and dynamics is not processed for disabled bodies.

void iBodyEnable(BODY*);
   BODY* = body object to re-enable. See iBodyDisable().

int iBodyStatus(BODY*);
   Return specified body status as follows:
   bit 0, TRUE for enabled, FALSE for disabled
   BODY* = body object
  
int iBodyScan(BODY*,D3DXVECTOR3*,D3DXVECTOR3*,float,D3DXVECTOR3*,D3DXVECTOR3*);
   Return subpart hit by the scan, or -1 if nothing is hit by the scan.
   BODY* = body object to scan
   D3DXVECTOR3* = scan origin
   D3DXVECTOR3* = scan direction. The length of this vector will be the length of the
                  scanning capsule.
   float = scan radius (capsule radius)
   D3DXVECTOR3* = contact point (absolute coordinates). Return data.
   D3DXVECTOR3* = contact normal (absolute orientation, outwards from body surface) Return data.
   NOTE: the scan is performed checking the specified capsule against the specified body, for
   intersections. Only the intersection closer to origin is considered, in case the
   capsule intersects the body at two or more points.

void iBodyEulerOrientationSet(BODY*,float,float,float,char*,BOOL);
   BODY* = body object
   float = rotation about X axis
   float = rotation about Y axis
   float = rotation about Z axis
   char* = 3-character string specifying the order in which to apply the rotations.
           For example, "xyz" (apply rotation about X first, followed by Y and Z),
           and "xzy" are valid strings.
   BOOL = TRUE to reset memorized previous orientation too (recommended).

void iBodyOrientationSet(BODY*,D3DXQUATERNION*,BOOL);
   BODY* = body object
   D3DXQUATERNION* = quaternion specifying an orientation.
   BOOL = TRUE to reset memorized previous orientation too (recommended).

void iBodyLocationSet(BODY*,D3DXVECTOR3*,BOOL);
   BODY* = body object
   D3DXVECTOR3* = 3d location
   BOOL = TRUE to reset memorized previous location too (recommended).
   NOTE: the center of the source model is used as a reference, not the center of mass
   computed by the engine. The object center is the world-center in your 3d modeler,
   when the object is exported to an .x file.
   NOTE: because rotations are always performed about the center of mass instead,
   setting the body orientation FIRST, and its location THEN, is recommended.

void iBodyLocationCMSet(BODY*,D3DXVECTOR3*,BOOL);
   BODY* = body object
   D3DXVECTOR3* = 3d location
   BOOL = TRUE to reset memorized previous location too (recommended).
   NOTE: unlike iBodyLocationSet(), this function sets the location for the specified body
   using its center of mass as a reference. The center of mass is automatically computed by
   the engine.

void iBodySpinSet(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = spin vector.
                  The vector direction is the axis of rotation (absolute).
                  The length of the vector is the rotation speed (spin).

void iBodyVelocitySet(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = velocity vector.

void iBodyPhysicsReset(BODY* body);
   BODY* = body object (must be sphere-group-based).
           NOTE: use this function to completely stop (remove energy from) a body

D3DXVECTOR3* iBodyLocationCM(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = location vector. Return data.
                  The vector is filled with the absolute location of center of mass for the
                  specified body. See also iBodyLocationCMSet().
   NOTE: this function returns a pointer to the location vector provided as parameter,
   so that this function can be directly used as a parameter for another function.

D3DXVECTOR3* iBodyCMOffset(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = offset vector. Return data.
                  The vector is filled with the offset of center of mass for the
                  specified body, respect to its model-center.
   NOTE: this function returns a pointer to the location vector provided as parameter,
   so that this function can be directly used as a parameter for another function.

D3DXVECTOR3* iBodyLocation(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = location vector. Return data.
                  The vector is filled with the absolute location of the source-model-center,
                  for the specified body. See also iBodyLocationSet().
   NOTE: this function returns a pointer to the location vector provided as parameter,
   so that this function can be directly used as a parameter for another function.

D3DXVECTOR3* iBodyPreviousLocation(BODY*,D3DXVECTOR3*);
   Retrieve body location at previous dll loop. See iBodyLocation() for more.

D3DXQUATERNION* iBodyOrientation(BODY*,D3DXQUATERNION*);
   BODY* = body object
   D3DXQUATERNION* = orientation. Return data.
   NOTE: this function returns a pointer to the orientation quaternion provided as parameter,
   so that this function can be directly used as a parameter for another function.

void iQuaternionFromAxisAngle(D3DXQUATERNION*,D3DXVECTOR3*,float);
   D3DXQUATERNION* = resulting quaternion. Return data.
   D3DXVECTOR3* = orientation axis.
   float = orientation angle.
   NOTE: input orientation is expressed by an axis (the vector) and an angle of
   rotation about that axis (float).

void iQuaternionToAxisAngle(D3DXQUATERNION*,D3DXVECTOR3*,float*);
   D3DXQUATERNION* = source quaternion.
   D3DXVECTOR3* = orientation axis. Return data.
   float* = orientation angle. Return data.
   NOTE: output orientation is expressed by an axis (the vector) and an angle of
   rotation about that axis (float*).

float iBodyYaw(BODY* body);
   Return specified body yaw (about Y axis).
   BODY* = body object

float iBodyPitch(BODY* body);
   Return specified body pitch (about X axis).
   BODY* = body object

float iBodyRoll(BODY* body);
   Return specified body roll (about Z axis).
   BODY* = body object

float iBodyKmh(BODY* body);
   Return specified body speed, in kilometers per hour.
   BODY* = body object

void iBodyVelocity(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = velocity vector. Return data.

void iBodyPointVelocity(BODY*,D3DXVECTOR3*,D3DXVECTOR3*);
   Return the velocity of a body point.
   BODY* = body object
   D3DXVECTOR3* = body point to compute velocity for. Source-model-center relative coordinates.
   D3DXVECTOR3* = velocity vector. Return data.

void iBodySpin(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = spin vector. See also iBodySpinSet().

void iBodySphereCenter(SUBPART*,D3DXVECTOR3*);
   SUBPART* sub-part (sphere) object
   D3DXVECTOR3* = sphere center location. Return data.
                  Note that the location is body-center-of-mass relative.
                  You can convert it to source-model-center with
                  iVectorXModelToBodyTransform() function.
                  You can then convert it to absolute coordinates with
                  iVectorBodyToWorldTransform() function.

float iBodySphereRadius(SUBPART*);
   Return radius of specified sub-part (sphere)
   SUBPART* sub-part (sphere) object

BOOL iBodyEnteringMesh(BODY*,D3DXVECTOR3*,MESH*);
   Return TRUE if the specified body is entering (passing through the surface of) the
   specified mesh, FALSE otherwise.
   BODY* = body object
   D3DXVECTOR3* = body object's point. Point coordinates are source-model-center relative.
   MESH* = mesh object

BOOL iBodyExitingMesh(BODY*,D3DXVECTOR3*,MESH*);
   Return TRUE if the specified body is exiting (passing through the surface of) the
   specified mesh, FALSE otherwise.
   BODY* = body object
   D3DXVECTOR3* = body object's point. Point coordinates are source-model-center relative.
   MESH* = mesh object

void iBodyForceApply(BODY*,D3DXVECTOR3*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = force.
   D3DXVECTOR3* = point the force is applied to.
                  Point coordinates are body-center-of-mass relative. If NULL, the
                  center of mass is assumed.
   NOTE: resulting acceleration depends on total body mass. For example, if you apply
   one-meter-long force-vector to a still body with mass=5, for one second,
   the body will travel 1/5 meters (0.2f). If you apply the same force to a body with
   mass=1, it will travel 1.0f meter instead.
   So, using iBodyAccelerationApply() is easier, if application point
   is the body center of mass.

void iBodyAccelerationApply(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = acceleration, in meters-per-second^2.
                  The length of the vector is acceleration intensity.

void iBodyTorqueApply(BODY*,D3DXVECTOR3*);
   Apply an angular force (torque) to the specified body.
   BODY* = body object
   D3DXVECTOR3* = torque.
                  Vector direction is the axis of rotation (absolute).
                  Length of the vector is angular force (torque) intensity.
   NOTE: resulting angular velocity depends on total body mass.
   So, using iBodyAngularAccelerationApply() can be easier.

void iBodyAngularAccelerationApply(BODY*,D3DXVECTOR3*);
   BODY* = body object
   D3DXVECTOR3* = angular acceleration, in degrees-per-second^2.
                  Vector direction is the axis of rotation (absolute).
                  Length of the vector is angular acceleration intensity.

void iBodyLocationAdd(BODY*,D3DXVECTOR3*,BOOL);
   BODY* = body object
   D3DXVECTOR3* = meters to add to current body location for every second.
                  Note that this function should be executed at every dll loop
                  to take effect.
   BOOL = TRUE to reset memorized previous location (recommended).
   Warning, direct (forced) changes of body location may affect collision response
   computation. Make sure the new location doesn't overlap collision-enabled bodies.

void iBodyEulerOrientationAdd(BODY*,float,float,float,char*,BOOL);
   BODY* = body object
   floats, char* = degrees to add to current body orientation for every second.
                   See iBodyEulerOrientationSet() for more on these parameters.
                   Note that this function should be executed at every dll loop
                   to take effect.
   BOOL = TRUE to reset memorized previous orientation (recommended).
   Warning, direct (forced) changes of body orientation may affect collision response
   computation. Make sure the new orientation doesn't overlap collision-enabled bodies.

void iBodyOrientationAdd(BODY*,D3DXQUATERNION*,BOOL);
   BODY* = body object
   D3DXQUATERNION* = rotation to add to current body orientation for every second.
                     Note that this function should be executed at every dll loop
                     to take effect.
   BOOL = TRUE to reset memorized previous orientation (recommended).
   Warning, direct (forced) changes of body orientation may affect collision response
   computation. Make sure the new orientation doesn't overlap collision-enabled bodies.

**********************************************************************************************
BODYBODY (collision couple)
**********************************************************************************************

BODYBODY* iBodyBodyCreate(BODY*,BODY*);
   Return bodybody (collision couple) object.
   BODY* = first body object of the collision couple to enable. Must be sphere-group-based.
   BODY* = second body object of the collision couple to enable. Can be either
           sphere-group-based or polyhedron-based.
   NOTE: by default, the engine doesn't perform any collision detection. The two
   BODY* parameters of this function tell the engine what body couple should
   be checked for collision.
   NOTE: collision between two polyhedron-based bodies is not supported.
   NOTE: the body with bigger mass should be the second parameter.

void iBodyBodyDestroy(BODYBODY*);
   BODYBODY* = bodybody object
   Disable collision detection/response for the specified collision couple.
   The collision couple can be re-enabled with iBodyBodyCreate().
   Note that destroying bodybody objects is not necessary because the engine will
   do it automatically on exit.

void iBodyBodyRestitutionSet(BODYBODY*,float);
   BODYBODY* = bodybody object
   float = restitution (between 0.0f and 1.0f inclusive, default is 0.5f)
           It is the bounciness of the two bodies when colliding. The smaller the
           factor, the lower the bounciness.
   NOTE: restitution is set the same for all sub-parts forming the two bodies.
   You can set specific restitution for each sub-part with iBodyBodySubpartRestitutionSet().

void iBodyBodyFrictionSet(BODYBODY*,float);
   BODYBODY* = bodybody object
   float = friction (greater than 0.0f, default is 0.0f)
           Zero means that there is no friction. Set a very high value for
           no-slipping friction (max is 3.402823466e+38f).
           The effect of this parameter changes, depending on friction model
           used. See iBodyBodyFrictionModeSet() for more.
   NOTE: friction is set the same for all sub-parts forming the two bodies.
   You can set specific friction for each sub-part with iBodyBodySubpartFrictionSet().

void iBodyBodyFrictionModeSet(BODYBODY*,int);
   BODYBODY* = bodybody object
   int = friction model (0 = Coulomb (default), 1 = friction pyramid).
         When Coulomb friction model is used, the friction parameter set with
         ...FrictionSet() instructions resembles real-world friction constant.
         You can use 10.0f as typical value, but may vary greatly depending on
         body masses.
         When friction pyramid model is used, it represents a different friction
         constant, typically around 1.0f.
   NOTE: friction model is set the same for all sub-parts forming the two bodies. You can
   set specific friction model for each sub-part with iBodyBodySubpartFrictionModelSet().

void iBodyBodySplitFrictionSet(BODYBODY*,float,float,float,float);
   Friction simulation is a complex issue that may require fine tuning. For example,
   to perfectly simulate wheel friction behavior, you may need to set different
   friction parameters for rolling and side directions.  
   BODYBODY* = bodybody object
   float = side friction when sliding along the X local axis of the first
   body (collision couple).
   float = side slip factor. Intermediate friction allows a certain amount of slipping,
           but you may need to tune this parameter as well to achieve accurate slip
           effects, especially for wheels.
   float = rolling-direction friction. Same as above, but for body rolling-direction.
   float = rolling direction slip factor. Same as above, but for body rolling-direction.
   NOTE: split friction parameters are set the same for all sub-parts forming the two bodies.
   You can set specific parameters for each sub-part with iBodyBodySubpartSplitFrictionSet().

void iBodyBodySubpartRestitutionSet(BODYBODY*,int,int,float,int,float,float,float,float);
   BODYBODY* = bodybody object
   int =   index of first body sub-part. The first body is the body specified as first
           parameter for the iBodyBodyCreate() function.
           The sub-part index must be 0 for the first sub-part, 1 for the second, and so on.
   int =   index of second body sub-part. The second body is the body specified as second
           parameter for the iBodyBodyCreate() function.
   NOTE: see iBodyBodyRestitutionSet() for remaining parameters.

void iBodyBodySubpartFrictionSet(BODYBODY*,int,int,float);
   BODYBODY* = bodybody object
   int =   index of first body sub-part. See iBodyBodySubpartRestitutionSet().
   int =   index of second body sub-part. See iBodyBodySubpartRestitutionSet().
   NOTE: see iBodyBodyFrictionSet() for remaining parameters.

void iBodyBodySubpartFrictionModelSet(BODYBODY*,int,int,int);
   BODYBODY* = bodybody object
   int =   index of first body sub-part. See iBodyBodySubpartRestitutionSet().
   int =   index of second body sub-part. See iBodyBodySubpartRestitutionSet().
   NOTE: see iBodyBodyFrictionModeSet() for remaining parameters.

void iBodyBodySubpartSplitFrictionSet(BODYBODY*,int,int,float,float,float,float);
   BODYBODY* = bodybody object
   int =   index of first body sub-part. See iBodyBodySubpartRestitutionSet().
   int =   index of second body sub-part. See iBodyBodySubpartRestitutionSet().
   NOTE: see iBodyBodySplitFrictionSet() for remaining parameters.

void iBodyBodyFeedbackEnable(BODYBODY*,int,int,BOOL);
   BODYBODY* = bodybody object
   int =   index of first body sub-part. The first body is the body specified as first
           parameter for the iBodyBodyCreate() function.
           The sub-part index must be 0 for the first sub-part, 1 for the second, and so on.
           If this parameter is -1, feedback is enabled/disabled for all sub

阅读(2118) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~