entity | Registered joint entity (PH_6DJOINT). |
JointMotion[6] | JointMotion[0-2] defines the 3 linear degrees of freedom
relative to the joint axis. |
JointDrive[6] |
JointDrive[0-2] defines the modes of the 3 linear motors. A8.12 JointDrive[3] defines the mode of the swing motor. JointDrive[4] defines the mode of the slerp motor. JointDrive[5] defines the mode of the twist motor. Use 0 for not using a motor on a certain axis, or one of these flags: NX_D6JOINT_DRIVE_POSITION for a motor that moves towards a given position. NX_D6JOINT_DRIVE_VELOCITY for a motor that moves with a given velocity. |
function main() { // set up a simple level shadow_stencil = 1; d3d_antialias = 1; physX_open(); level_load(""); // load an empty level pXent_settype(NULL,PH_STATIC,PH_PLANE); // create a static plane at groundlevel zero ENTITY* ground = ent_createterrain(NULL,NULL,32,32,1000); bmap_fill(bmap_for_entity(ground,0),COLOR_RED,100); vec_set(camera.x,vector(-150,0,50)); // set up a chain of 6D joints ENTITY* previous = NULL; int i; for(i=0; i<3; i++) { you = ent_create(CUBE_MDL,vector(0,0,17+i*34),NULL); you.scale_z = 2;
set(you,SHADOW|CAST);
pXent_settype(you,PH_RIGID,PH_BOX);
// define a joint with a twist motor pXcon_add(PH_6DJOINT,you,previous,0); var Motion[6] = { 0,0,0,0,0,NX_D6JOINT_MOTION_FREE }; var Drive[6] = { 0,0,0,0,0,NX_D6JOINT_DRIVE_VELOCITY }; pXcon_set6djoint(you,Motion,Drive); // rotate joint against the previous joint pXcon_setmotor(you,vector(20,0,0),0); previous = you; } }