how to make camera in DemoBspCollision to move only on the ground no matter whats direction (orientation?) it is? should I use here RaySceneQuery to check distance from camera to ground? (I tried this, my code crashed).
thanks, for your answer.
camera on the ground
-
- Gnoblar
- Posts: 9
- Joined: Thu Mar 17, 2005 3:29 pm
- Location: Vilnius, Lithuania
-
- Gnoblar
- Posts: 9
- Joined: Thu Mar 17, 2005 3:29 pm
- Location: Vilnius, Lithuania
-
- Gnoblar
- Posts: 9
- Joined: Thu Mar 17, 2005 3:29 pm
- Location: Vilnius, Lithuania
I still have the same dificulty with moving my camera in BSP world. when changed direction, it moves along it's vector, not on the ground. I am doing with RaySceneQuery to check if my camera is over the ground, but no more than 10 units. in my program I use code from TerrainDemo example, but it works not properly with BSP world. the code I use:
thank you.
- in createScene() method:
Code: Select all
raySceneQuery = mSceneMgr->createRayQuery( Ray(mCamera->getPosition(), Vector3::NEGATIVE_UNIT_Z));
- in frameEnded() method of Refference Application Frame Listener class
Code: Select all
static Ray updateRay; updateRay.setOrigin(mCamera->getPosition()); updateRay.setDirection(Vector3::NEGATIVE_UNIT_Z); raySceneQuery->setRay(updateRay); RaySceneQueryResult& qryResult = raySceneQuery->execute(); RaySceneQueryResult::iterator i = qryResult.begin(); if (i != qryResult.end() && i->worldFragment) { zfHeroNode->setVisible(false); SceneQuery::WorldFragment* wf = i->worldFragment; mCamera->setPosition(mCamera->getPosition().x, mCamera->getPosition().z, i->worldFragment->singleIntersection.y + 10); }
thank you.
-
- OGRE Retired Moderator
- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 7
-
- Gnoblar
- Posts: 9
- Joined: Thu Mar 17, 2005 3:29 pm
- Location: Vilnius, Lithuania