I ran into a odd little thing today. I was playing with setAutoTracking on a camera. I found that when I called clearScene() from the scenemanager I was getting an unhandled exception (an access violation, the debugger revealed) which was apparently happening in Camera::_autoTrack()
I found if I called setAutoTracking(false); on the camera right before clearScene() then I had no problems at all, so the issue certainly isn't critical, but it did seem a little odd.
Is this a bug or by design? Either way just thought I would bring it up.
Access Violation on clearScene(); with autotracking camera.
-
- Halfling
- Posts: 88
- Joined: Wed Sep 29, 2004 3:33 am
- Location: Ohio, USA
Access Violation on clearScene(); with autotracking camera.
I <3 the OGRE Wiki, and SO SHOULD YOU! 

-
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
-
- Halfling
- Posts: 88
- Joined: Wed Sep 29, 2004 3:33 am
- Location: Ohio, USA
:wumpus: wrote:Could you post the exact line it happens?
Code: Select all
void Camera::_autoTrack(void)
{
// NB assumes that all scene nodes have been updated
if (mAutoTrackTarget)
{
lookAt(mAutoTrackTarget->_getDerivedPosition() + mAutoTrackOffset); //<-- RIGHT HERE
}
}
EDIT: I should mention this is in a state-management system.. clearScene() is getting called when the state exits (back to main menu), but the camera remains since the mRoot is not destroyed till the main menu exits.
I <3 the OGRE Wiki, and SO SHOULD YOU! 

-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
You will have to tell the camera to stop tracking if you destroy the scene; nodes don't know when a camera is tracking them so can't tell it to stop. It is possible to sort it out on clearScene but not for removal of a specific node so the principle should apply globally. Sorry, for some reason I thought you meant node-node tracking.