|
Physics Problem
#333090
07/13/10 23:45
07/13/10 23:45
|
Joined: Jul 2010
Posts: 129
bk9iq
OP
Member
|
OP
Member
Joined: Jul 2010
Posts: 129
|
Hello all, I was trying to get a physics interaction between my character and a ball in the level such that when the player comes close to the ball, he pushes it in the direction it is supposed to move.. I am using this code but when I am coming close, the ball is not moving at all ENTITY* ball;
function physics_ball() { ball = ent_create ("ball.mdl", vector(-400, 0, 100), NULL); // create the ball c_setminmax(ball); pXent_settype (ball, PH_RIGID, PH_SPHERE); // set the physics entity type pXent_setfriction (ball,50); // set the friction on the ground pXent_setdamping (ball,10,10); // set the damping pXent_setelasticity (ball,50); // set the elasticity pXent_setmass(my,1); while(1) { //Pushs the ball if the character is 100 quants nearby if(vec_dist(player.x,ball.x)<100){ VECTOR temp; vec_set(temp,ball.x); vec_sub(temp,player.x); vec_normalize(temp,4); pXent_addvelcentral(ball,vector(temp.x,temp.y,temp.z)); } wait(1); } }
I added the #include <ackphysx.h> and physX_open(); So please what is the problem here
Last edited by bk9iq; 07/13/10 23:46.
|
|
|
Help Please
[Re: bk9iq]
#333094
07/14/10 00:30
07/14/10 00:30
|
Joined: Jul 2010
Posts: 129
bk9iq
OP
Member
|
OP
Member
Joined: Jul 2010
Posts: 129
|
|
|
|
|