[SOLVED] RayTest and some little questions

aleradish
Posts: 22
Joined: Thu Mar 05, 2009 9:41 pm

[SOLVED] RayTest and some little questions

Post by aleradish »

Good Morning

I'm trying to make Raytest using only Collision Library.. I need to make a raytest and evaluating the collision through an object.
For try Raytest Function, I've made a try little application... That evaluates a collision through a very big object; The rayTest doesn't reveal the collision and I don't know why...

Ogre::Camera* Camera=camera->getOgreCamera();
Entity* Target=target->getOgreEntity();
btVector3 EPos=VectorConverter(target->getWorldPosition());
cprintf("\nTarget Position..x;%2.2f y:%2.2f z:%2.2f",EPos.x(),EPos.y(),EPos.z());
//creating target Collision Object...

cprintf("\n... Creating Target Collision Object...");
btCollisionObject* TargetObj=new btCollisionObject();
btCollisionShape* TargetShape=new btBoxShape(btVector3(10,10,10));
TargetObj->setCollisionShape(TargetShape);
btTransform TransT;
TransT.setOrigin(btVector3(0,0,0));
TargetObj->setWorldTransform(TransT);
this->W->addCollisionObject(TargetObj);

btCollisionWorld::ClosestRayResultCallback CBack(btVector3(0,0,-100),btVector3(0,0,100));
this->W->rayTest(btVector3(0,0,-100),btVector3(0,0,100),CBack);

if(CBack.hasHit()){
cprintf("Has Hit!!!!:)");
}else{
cprintf("No Hit!!!!:\\");
}

return CBack.hasHit();

anyOne has any Ideas? where I make wrong?

Another thing... What are the m_normalHit ,m_normalWorldPoint , Parameter...

How Can I make a test if 2 object are or not in collision? and there is a possibilities of reveal the depth of the collision?

Thank you so Much
aleradish
Posts: 22
Joined: Thu Mar 05, 2009 9:41 pm

Re: [SOLVED] RayTest and some little questions

Post by aleradish »

Solved :P

I didn't put to identity the transform with the method

btTransform.setIdentity()
before to put the transform like I want.
Probably that Cause a Problem...

I hope that will be useful for Your, and I've posted the solution... Bye!!