selecting objects

Dutchie

03-07-2007 15:22:39

i am trying to get a code to select objects in my scene(NxOgre objects ofcourse). but im not getting it right...

does someone have a code to use with 0.9-27 where i can select objects with...

daedar

03-07-2007 16:26:53

NxOgre::Actor* PhysicEngine::getActor(Vector3 pos, Vector3 dir, float len){
NxOgre::RayCaster* caster = new NxOgre::RayCaster(pos, dir, len, NxOgre::RayCaster::RCT_CLOSEST, nxScene);
caster->castShape(NxOgre::RayCaster::AF_NONE);
NxOgre::Actor *actor = caster->getClosestActor();
delete caster;
return actor;
}


you can also check the result of castShape to know if your raycast has hit an actor.

EDIT: dir has to be normalised before be used with a RayCaster