ogre-next
ogre-next copied to clipboard
[2.3] Derived Position appears to be wrong when InheritScale is false
System Information
- Operating System / Platform: MacOS 11
- RenderSystem: Metal
Detailed description
Position that I'm getting back from _getDerivedPositionUpdated seems to be very wrong when Inherit Scale is off.
Sample code
Creates 3 cubes, the 3rd cube is purely to visualise the output of _getDerivedPositionUpdated from the second cube.
Ogre::Item* item = sceneManager->createItem( "Cube_d.mesh",
Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME,
Ogre::SCENE_DYNAMIC );
auto node1 = sceneManager->getRootSceneNode( Ogre::SCENE_DYNAMIC )->
createChildSceneNode( Ogre::SCENE_DYNAMIC );
node1->setPosition(0, 0, 0);
node1->setScale(2, 2, 2);
node1->attachObject( item );
item = sceneManager->createItem( "Cube_d.mesh",
Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME,
Ogre::SCENE_DYNAMIC );
auto node2 = sceneManager->createSceneNode();
node2->setPosition(0, 4, 0);
node2->setScale(1, 1, 1);
node2->attachObject( item );
node2->setInheritScale(false);
// node 2 is nested inside of node 1
node1->addChild(node2);
item = sceneManager->createItem( "Cube_d.mesh",
Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME,
Ogre::SCENE_DYNAMIC );
auto node3 = sceneManager->getRootSceneNode( Ogre::SCENE_DYNAMIC )->
createChildSceneNode( Ogre::SCENE_DYNAMIC );
node3->setPosition(node2->_getDerivedPositionUpdated() + Ogre::Vector3(5, 0, 0));
node3->setScale(1, 1, 1);
node3->attachObject( item );
Screenshots
When node2->setInheritScale(false)
is commented:

When node2->setInheritScale(false)
is present: (note how the 3rd node no longer matches the y position of the second node)