Camera with setViewMatrixAffector

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
achpile
Posts: 5
Joined: Mon Oct 27, 2014 7:21 am

Camera with setViewMatrixAffector

Post by achpile »

Hi, guys! I need help with affector... The problem is in detection scene nodes in field of view of the camera with ViewMatrixAffector.

Image

So, the "Scene node 2" isn't drawn because it's invisible by Camera without affector. May be it's a bug, or may be wrong sequence of my doings:

Code: Select all

/**
The camera is moved on -25
But the "drawn field of view" not
*/
 
driver->beginScene(true, true, irr::video::SColor(255, 0, 0, 0));
 
viewMatrix.makeIdentity();
viewMatrix.setTranslation(irr::core::vector3df(0, -25, 0));
cam->setViewMatrixAffector(viewMatrix);
smgr->drawAll();
 
driver->endScene(); 
CuteAlien
Admin
Posts: 9930
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Camera with setViewMatrixAffector

Post by CuteAlien »

Must admit I never used the setViewMatrixAffector. Maybe let's figure out first if it removes stuff because of culling. Can you for a test disable culling for your scenenode completely? You can do so with node->setAutomaticCulling(0).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
achpile
Posts: 5
Joined: Mon Oct 27, 2014 7:21 am

Re: Camera with setViewMatrixAffector

Post by achpile »

CuteAlien wrote:Must admit I never used the setViewMatrixAffector. Maybe let's figure out first if it removes stuff because of culling. Can you for a test disable culling for your scenenode completely? You can do so with node->setAutomaticCulling(0).
nope, it's not culling :|

well, I missed some important thing.

It was something like this:

Code: Select all

 
irr::scene::ISceneNodeAnimatorCollisionResponse* collider = smgr->createCollisionResponseAnimator(
                selector, player->cam, irr::core::vector3df(25,50,25),
                irr::core::vector3df(0, -10.f,0),
                irr::core::vector3df(0,0,0), 0.005f);
 
driver->beginScene(true, true, irr::video::SColor(255, 0, 0, 0));
 
viewMatrix.makeIdentity();
viewMatrix.setTranslation(irr::core::vector3df(0, -25 + PLAYER_HEAD_TILT * sin(moving), 0));
cam->setViewMatrixAffector(viewMatrix);
smgr->drawAll();
 
driver->endScene(); 
 
So the problem appears. After I changed it to:

Code: Select all

 
irr::scene::ISceneNodeAnimatorCollisionResponse* collider = smgr->createCollisionResponseAnimator(
                selector, player->cam, irr::core::vector3df(25,50,25),
                irr::core::vector3df(0, -10.f,0),
                irr::core::vector3df(0,25,0), 0.005f);
 
viewMatrix.setTranslation(irr::core::vector3df(0, PLAYER_HEAD_TILT * sin(moving), 0));
 
And after that it becomes correct. (PLAYER_HEAD_TILT = 3.0f, so it's almost slight)
Post Reply