Hi,

for anyone who runs into this, the solution is to add a call to pX_setunit. see below in the code.

I've got a really small sample that worked fine in A7.7866 and when moving to A8 and PhysX the ball wants to stick to the walls after the first bounce off a wall.

the first bounce seems to be good but when hitting the next wall it's like the wall sucks all the momentum out of the ball and it falls to the floor and wants to move along the wall not bounce away. It's almost like the collision is taking too much energy away than it should. I would appreciate any ideas.

#include <Acknex.h>
#include <ackphysX.h>

#define PRAGMA_PATH "files";

ENTITY* aBall;

function HitBall(key)
{
VECTOR* v;

v = vector(150,0,75);
vec_rotate(v,camera.pan);

// Now apply the speed to the ball
pXent_addvelcentral(aBall,v);
}

int main ()
{
add_folder("files");

physX_load();
pX_setccd(1);

level_load("paths.wmb");

aBall = ent_create("ball.mdl",vector(-115,180,192),NULL);
aBall.scale_x = 0.5;
aBall.scale_y = 0.5;
aBall.scale_z = 0.5;

collision_mode = 1;

pX_setunit(1); <===== adding this line fixes issue

pXent_settype(NULL,PH_STATIC,PH_POLY);
pXent_setcollisionflag(aBall,NULL,NX_NOTIFY_ON_START_TOUCH);
pXent_setccdskeleton(aBall,vector(0,0,0),1);
pXent_settype(aBall,PH_RIGID,PH_SPHERE);
pXent_setmass(aBall,0.1);
pXent_setfriction(aBall,10.0);
pXent_setelasticity(aBall,90.0);
pXent_setdamping(aBall,0.0,0.0);
pXent_addvelcentral(aBall,vector(2,2,75));
pX_setgravity(vector(0,0,-1));

camera.arc = 120;

on_anykey = HitBall;

while(1)
{
physX_run(time_step/16);
wait(1);
}

physX_destroy();
}

Last edited by LazyDog; 03/01/11 23:06. Reason: Solution Found

www.LazyDogSoftware.com
Delphi SDK Homepage

A7 Pro 780
Delphi 5 through 2010