With this function you can create advanced materials.
entity | registered Entity pointer (Actor) |
standard | Restitution, staticFriction, dynamicFriction |
frictionV | StaticFrictionV, dynamicFrictionV, flags |
anisotropic | Direction Of Anisotropy |
1 if successful, 0 otherwise.
Direction Of Anisotropy: This vector, relative to the shape's own coordinate frame, defines the primary direction of anisotropy. Useful to create e.g. a ski material.
Fast
function material_test() { ENTITY* box1 = ent_create("box1.mdl",vector(1000,150,280),NULL); ENTITY* box2 = ent_create("box2.mdl",vector(1000,70,280),NULL); box1.tilt=35; box2.roll=-35; box2.pan=90; set(box1,PASSABLE); set(box2,PASSABLE); pXent_settype(box1,1,PH_BOX); pXent_settype(box2,1,PH_BOX); // simple material for box1: pXent_setelasticity(box1,100); pXent_setdamping(box1,10,10); pXent_setfriction(box1,5); // complex material for box2: var restitution = 50; var staticFriction = 0; var dynamicFriction = 0; var staticFrictionV = 100; var dynamicFrictionV = 100; var dirOfAnisotropy[3] = {0,1,0}; pXent_setmaterial( box2, vector(restitution, staticFriction, dynamicFriction ), vector(staticFrictionV, dynamicFrictionV, NX_MF_ANISOTROPIC ), vector(dirOfAnisotropy[0], dirOfAnisotropy[1], dirOfAnisotropy[2] )); }