ICameraSceneNode->setVisible(0) disables setPosition()

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
wyrmmage
Posts: 204
Joined: Sun Mar 16, 2008 3:12 am
Contact:

ICameraSceneNode->setVisible(0) disables setPosition()

Post by wyrmmage »

Hello :)

I've discovered a rather curious bug with the camera class (it certainly took me awhile to track it down XD): when you call setVisible(0) on the node, all setPosition() calls afterward are completely ignored. This is very easy to test:

Code: Select all

ICameraSceneNode* nodeCamera = sceneManager->addCameraSceneNode(NULL, vector3df(0.0, 0.0, 0.0), vector3df(0, 0, 5));
nodeCamera->setVisible(0);
nodeCamera->setPosition(vector3df(0.0, 0.0, 1000.0));
nodeCamera->setTarget(vector3df(0, 100, 0));
Note that setTarget is unaffected.

Is this a feature, or a bug? If it's a feature, it'd be nice if it were mentioned somewhere in the documentation; if it's a bug, I'll try to look into it :)
-wyrmmage
Worlds at War (Current Project) - http://www.awkward-games.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
Katsankat
Posts: 178
Joined: Sun Mar 12, 2006 4:15 am
Contact:

Post by Katsankat »

I noticed the same thing, which happened because the cam was parented to an invisible node. Someone will suggest to make it visible, move it, and hide it.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

What exactly do you mean when you say that setPosition() calls are ignored? Are you saying that nodeCamera->getPosition() is not returning core::vector3df(0.f, 0.f, 1000.f)? Does the view not update to the new position if the camera is not visible? Is there some other problem?

AFAICT, getPosition() should work as expected (the position will be updated), so I doubt that is the problem.

So I'm guessing that the issue is that when the scene managers active camera is not visible, the view doesn't respond to camera state changes. To be honest, I don't know what I'd expect if the active camera is not visible. I'd expect consistent behavior from all camera types and all methods, but I'm not sure what the behavior should be exactly. If you wanted to discuss your point further, you'd have to explain what you think it means for the active camera to be not visible, and maybe explain why you want to make your camera not visible.

Travis
wyrmmage
Posts: 204
Joined: Sun Mar 16, 2008 3:12 am
Contact:

Post by wyrmmage »

Katsankat: My node is parented to nothing (just the SceneManager, since I specified NULL as the parent, I believe). Now that you mention it, I think this has been discussed before several times :(

Vitek: I'm sorry, I should have been more specific; what I meant was that the view does not update if the camera is invisible. getPosition() returns the expected values (0.0f, 0.0f, 1000.0f)

As soon as one makes the camera visible again, the view is updated; in other words, you can do this:

Code: Select all

cameraNode->setVisible(0);
cameraNode->setPosition(0, 0, 1000);
cameraNode->setVisible(1);
and it'll set the position and update the view :)

I'm not sure what it should mean for the camera to be invisible, but the reason that I did it was so that the camera would not participate in collision detection and response :)
-wyrmmage
Worlds at War (Current Project) - http://www.awkward-games.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
Katsankat
Posts: 178
Joined: Sun Mar 12, 2006 4:15 am
Contact:

Post by Katsankat »

You could perhaps change the camera affector.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

How are you doing your collision? If you are using the collision manager and the collisoin response animator, just don't create a selector for the camera. If you are trying to avoid the node being picked with the collision manager methods like getSceneNodeFrom...BB(), just set the id of the camera to 0.

Travis
wyrmmage
Posts: 204
Joined: Sun Mar 16, 2008 3:12 am
Contact:

Post by wyrmmage »

Good to know, thanks :)

I guess the current behavior for the invisible camera does make sense (although it didn't use to do this in 1.4); if the ISceneNode is invisible, it's just treated as if it isn't part of the scene graph, but the camera's setTarget method isn't inherited from ISceneNode, so it's not going to pay attention that particular method.

It would be nice if the docs were updated to provide a bit more info on this, though, IMHO :)
-wyrmmage
Worlds at War (Current Project) - http://www.awkward-games.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Agreed, documented and tested behavior is always a plus.
Post Reply