xius
03-05-2009 15:29:38
Hello, reader!
Using SHADOWTYPE_TEXTURE_MODULATIVE is perfectly ok, but ugly. When trying SHADOWTYPE_STENCIL_ADDITIVE/MODULATIVE, raycasting provided by PhysX can't hit any shape:
I'm not very experienced OGRE, nor PhysX user so that I'm lost now. Is there a certain reason why shadow technique affects raycasting? (or something is rotten in my code?)
Using SHADOWTYPE_TEXTURE_MODULATIVE is perfectly ok, but ugly. When trying SHADOWTYPE_STENCIL_ADDITIVE/MODULATIVE, raycasting provided by PhysX can't hit any shape:
SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
mgr->setAmbientLight(ColourValue(1.0, 1.0, 1.0));
mgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); // <- there
NxActor * pick(int x, int y) {
letGo();
NxRay ray;
viewUnProject(x, y, 0.0f, ray.orig);
viewUnProject(x, y, 1.0f, ray.dir);
ray.dir -= ray.orig;
ray.dir.normalize();
NxRaycastHit hit;
NxShape* closestShape = PxScene->raycastClosestShape(ray, NX_ALL_SHAPES, hit); // returns NULL O_o
...
I'm not very experienced OGRE, nor PhysX user so that I'm lost now. Is there a certain reason why shadow technique affects raycasting? (or something is rotten in my code?)