Topic: problems with ray using c ++
I wanna work with maratis SDK following the example of the engine manual use, I'm trying to make a ray to know on top of which object is the mouse placed regarding what IsRayHit() function does which always returns false instead of detecting the object, I leave you the code
float x = input->getAxis("MOUSE_X");
float y = input->getAxis("MOUSE_Y");
MVector3 vi = camera->getUnProjectedPoint(MVector3(x,y,0));
MVector3 vo = camera->getUnProjectedPoint(MVector3(x,y,1));
//cout<<" "<<vo.x<<" "<<vo.y<<" "<<vo.z<<endl;
if(physics->isRayHit(vi, vo, &collisionObjId, &point)){
exit(0);
}
//cout<<point.x<<" "<<point.y<<" "<<point.z<<endl;
MOEntity * entity = scene->getEntityByName("monkey");
MPhysicsProperties * phyProps = entity->getPhysicsProperties();
cout<<phyProps->getCollisionObjectId()<<endl;
The object has a physical property active, but the ray is not detecting it
Last edited by ArielRiv (2015-03-26 16:43:36)