setRenderingDistance on ManualObject

Problems building or running the engine, queries about how to use features etc.
Post Reply
Anthea
Kobold
Posts: 25
Joined: Tue Oct 28, 2014 1:03 pm

setRenderingDistance on ManualObject

Post by Anthea »

I am using setRenderingDistance on my ManualObject on a low distance. Odly the objects on the right disappear if I go left with my camera. So its applied to the wrong objects. Could anyone post how to deal with setRenderingDistance?



my manual objects:

Code: Select all

mManualObject->begin(mMaterial, Ogre::RenderOperation::OT_TRIANGLE_LIST);

	//populate
	mManualObject->end();
	mManualObject->setRenderingDistance(100);
my camera:

Code: Select all

	
        camera->setNearClipDistance(5);
	camera->setFarClipDistance(99999 * 6);
	camera->setUseRenderingDistance(true);

camera movement:

Code: Select all

	//capture keyboard and move the player accordingly
	OIS::Keyboard* keyboard = OgreFramework::getSingletonPtr()->m_pKeyboard;
	int forward = (keyboard->isKeyDown( OIS::KC_W ) ? 0 : 1) + (keyboard->isKeyDown( OIS::KC_S ) ? 0 : -1);
	int leftRight = (keyboard->isKeyDown( OIS::KC_A ) ? 0 : 1) + (keyboard->isKeyDown( OIS::KC_D ) ? 0 : -1);

	//there seems to be some movement, so move the cams
	if (forward !=0 ||leftRight != 0)
	{	
		//get direction of cam
		Ogre::Vector3 dirX = camera->getDerivedOrientation();
		Ogre::Vector3 dirZ = camera->getDerivedOrientation();
			
		//update camera position
                camNode->setPosition( camNode->getPosition+ dirZ * forward * timeSinceLastFrame * PLAYER_SPEED
			+ dirX * leftRight * timeSinceLastFrame * PLAYER_SPEED);
	}
Is it a problem that I update the position of the camNode and not the camera itself?

Thanks!
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: setRenderingDistance on ManualObject

Post by Kojack »

Anthea wrote:Odly the objects on the right disappear if I go left with my camera. So its applied to the wrong objects.
That sounds correct. If you move the camera left then objects on the right will get further away. As soon as they are further than the rendering distance you set, they will stop rendering.
Anthea
Kobold
Posts: 25
Joined: Tue Oct 28, 2014 1:03 pm

Re: setRenderingDistance on ManualObject

Post by Anthea »

I would expect it to apply to distant objects also. So it would react like a clipping plane. But it doesn't.

Image
Post Reply