ColeZero
03-06-2006 15:26:57
I'm currently working on a demo where i can pick up some boxes, like a gravity-gun^^ or cellfactor.So this is my code:
So with this code i can bounce a box, which i'm looking at, every time i click
So do you have any suggestions how i can pick up a box?
Maybe with HitBody->setGlobalPosition(EndofRay), or something?
Vector3 dir, vec;
Quaternion orient = mCamera->getOrientation();
Vector3 pos = mCamera->getPosition();
vec = Vector3(0,0,-1);
dir = orient * vec;
ray = mScene->createRayCaster(pos,dir);
ray->cast();
HitBody = ray->mHitBody; //Need to check if no body is getting hit by the ray, else an error
would appear if you look into the "sky"
HitBody->addForce(dir * 100); //For testing
So with this code i can bounce a box, which i'm looking at, every time i click
So do you have any suggestions how i can pick up a box?
Maybe with HitBody->setGlobalPosition(EndofRay), or something?