Sussch
03-10-2010 16:46:02
Hey,
I'm having problems with teleporting camera node into another zone.
The zone is known into which the camera node is to be teleported. The
only problem is that the camera node is moved and teleported through
physics so that camera node position update is not immediate
(not sure if it would affect anything).
Current teleportation code is the following:
What happens:
Camera node pops into the correct place with the correct zone as its home.
However, the zone is not rendered - the only zones rendered are the ones where the
camera node used to be before the teleportation.
Edit: The problem is moving from one zone to another without following portals - I can reproduce the same behaviour when jumping into another zone over a portal. When I move the player back into the zone from which the player teleported / jumped out, rendering works okay again.
I have tried the following:
I'm having problems with teleporting camera node into another zone.
The zone is known into which the camera node is to be teleported. The
only problem is that the camera node is moved and teleported through
physics so that camera node position update is not immediate
(not sure if it would affect anything).
Current teleportation code is the following:
// p_zone is the target zone
m_camera_node->setHomeZone( p_zone );
p_zone->_addNode( m_camera_node );
What happens:
Camera node pops into the correct place with the correct zone as its home.
However, the zone is not rendered - the only zones rendered are the ones where the
camera node used to be before the teleportation.
Edit: The problem is moving from one zone to another without following portals - I can reproduce the same behaviour when jumping into another zone over a portal. When I move the player back into the zone from which the player teleported / jumped out, rendering works okay again.
I have tried the following:
m_camera_node->removeReferencesToZone( the zone from which the player teleported );
m_camera_node->clearNodeFromVisitedZones();
m_camera_node->clearVisitingZonesMap();
m_camera_node->savePrevPosition(); // after setting the new home zone
m_camera_node->_update( true, true ); // after setting the new home zone
[/list:u]
If any of those must have actually fixed it for me, then the problem might be that camera node position is not updated immediately after changing homeZone.
Edit: I also tried to destroy the camera, perform an _update and then create another one, forcing it not to use frame to frame coherence cache, but it didn't seem to have helped. I'm out of ideas again.
Edit: Tried two m_camera_node->_update(true, true)'s and a m_camera_node->setHomeZone(NULL) called manually after the teleportation. Also tried _updatePCZSceneNode(m_camera_node) after m_camera_node->setHomeZone(NULL). None of it worked, still the same problem that it places the camera node into the correct zone, but doesn't render the new zone nor any zones near it. It just gets stuck rendering the old zones.
I'm using the PCZSceneManager version that comes with Ogre Mercurial.
Any ideas?
Thanks