pXent_move (ENTITY* entity, VECTOR* vReldist, VECTOR* vAbsdist);

Directly move a physics entity or character controller globally (in world coordinates) and locally (in entity coordinates).

Parameters:

entity registered physics entity, kinematic entity, or character controller.
vReldist Move distance vector in entity coordinates.
vAbsdist Move distance vector in world coordinates.

Returns:

Nonzero on PH_CHAR collisions, 0 otherwise.

Remarks:

Speed:

Medium

Example:

#include <default.c>
#include <ackphysx.h

// Example of the four move modes with and without physics
// comment one of them in for testing
//#define RIGID
//#define KINEMATIC
#define CHARACTER
//#define C_MOVE

function main()
{  
  shadow_stencil = 1;
  physX_open();
  level_load("");
    
  vec_set(camera.x,vector(-1000,0,600));
  vec_set(camera.pan,vector(0,-40,0));
    
  ENTITY *ground = ent_createterrain(NULL, NULL, 32, 32, 100);
  bmap_fill(bmap_for_entity(ground, 0),COLOR_GREEN,100);
  pXent_settype(ground,PH_STATIC,PH_TERRAIN);
  pXent_setfriction(ground,0);
  
  ENTITY *actor = ent_create(CUBE_MDL, vector(0, 0, 20), NULL);
  vec_set(actor.scale_x,vector(5,2,1));
  vec_set(actor.blue,COLOR_RED);
  set(actor,LIGHT|SHADOW);
  
#ifdef RIGID
  pXent_settype(actor, PH_RIGID, PH_BOX);
#endif  
#ifdef KINEMATIC
  pXent_settype(actor, PH_RIGID, PH_BOX);
  pXent_setbodyflag(actor,NX_BF_KINEMATIC,1);
#endif  
#ifdef CHARACTER  
  pXent_settype(actor, PH_CHAR, PH_BOX);
#endif

  wait(-1); // wait with moving until objects are loaded and time_step is settled
  while(1)
  {
    actor.skill1 += 5*time_step; // angle
actor.skill4 = 15*time_step; // speed #ifdef C_MOVE vec_set(actor.pan,actor.skill1); c_move(actor,actor.skill4,NULL,0); #else pXent_rotate(actor,NULL,actor.skill1); pXent_move(actor,actor.skill4,NULL); #endif wait(1); } }

See also:

PH_CHAR, NX_BF_KINEMATIC, pXent_rotate, pXent_setposition, c_move