Ogre Version: :2.1:
Operating System: :Windows 10:
Render System: :OpenGL:
Disclaimer: I am using an outdated build 2.1 with some cherry-picks because there are source incompatible changes in the upstream that I haven't taken the time to figure out. And I am also using some v1 API because I have ported my game from Ogre 3D 1.8 and have lots of old assets and an old Blender export script to be compatible with. I apologize if this is the cause of my problems and totally understand if no one wants to spend any time on helping me with an outdated setup. But if you happen to know that upgrading would or would not solve my problem, then that would be very valuable information for me. Also, any help or experience with this is appreciated of course
Anyway, the problem is this: I have an object (a player character) with a skeleton and added a v1::TagPoint to one of its bones. I have a listener on the tag point and whenever an update triggers, I move another object in the scene (e.g. a hat that is connected to the character's head) by making it match the tag point.
My problem is that it seems like the updated transform for the hat object does not come into effect before the next frame, so when the character is moving, the hat is always lagging one frame behind.
So is this the wrong approach? If not, any ideas on what I could try to work around it? etc.
As I said, any input or guidance is highly appreciated
[2.1] Objects moved by tag points lagging behind
-
- Gnoblar
- Posts: 11
- Joined: Mon Aug 25, 2014 4:47 pm
- Contact:
- sercero
- Bronze Sponsor
- Posts: 450
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 156
Re: [2.1] Objects moved by tag points lagging behind
Hello,
Are you by any chance using this function?
API doc: https://ogrecave.github.io/ogre/api/2.1 ... d63861a33a
I am using that function to attach a sword entity to a bone handle in my model:
That way, when the hand moves (the hand is the parent of the sword handle) the sword moves as well.
Best regards,
Guillermo
Are you by any chance using this function?
Code: Select all
attachObjectToBone()
TagPoint* Ogre::v1::Entity::attachObjectToBone ( const String & boneName,
MovableObject * pMovable,
const Quaternion & offsetOrientation = Quaternion::IDENTITY,
const Vector3 & offsetPosition = Vector3::ZERO
)
I am using that function to attach a sword entity to a bone handle in my model:
Code: Select all
mBaseEntity->attachObjectToBone("handle.L", mSword, Ogre::Quaternion(0.707f, 0.707f, 0, 0), Ogre::Vector3(0, -0.1f, 0));
Best regards,
Guillermo
-
- Gnoblar
- Posts: 11
- Joined: Mon Aug 25, 2014 4:47 pm
- Contact:
Re: [2.1] Objects moved by tag points lagging behind
Thanks!
I think the reason I moved away from that function to adding the tag points manually is that it only supports a single attachment per bone (I may be misremembering this), and I need to have the possibility of multiple objects on the same bone. But it is a very good point. If I can make that work correctly I can look at the implementation to see what I am doing wrong.
I think the reason I moved away from that function to adding the tag points manually is that it only supports a single attachment per bone (I may be misremembering this), and I need to have the possibility of multiple objects on the same bone. But it is a very good point. If I can make that work correctly I can look at the implementation to see what I am doing wrong.
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1280
- Contact:
Re: [2.1] Objects moved by tag points lagging behind
Hi!
We have a very similar known issue with v2's TagPoints.
As for your specific problem: We update the scene nodes, then the tagpoints. So if as a result of a listener you updated a scene node from a tagpoint, it is already too late, it won't be seen until next call to SceneManager::updateAllTransforms (which is usually next frame unless it's called explicitly).
A simple solution is to call node->_getFullTransformUpdated() to force the particular node to be updated. Calling _getFullTransformUpdated is not advised if you have a lot of nodes due to its performance hit, but if it's a few nodes it's not an issue. At one point the performance hit of calling many _getFullTransformUpdated per node surpasses the cost of calling updateAllTransforms.
Btw are you building in debug? (or set OGRE_DEBUG_LEVEL_RELEASE being >= 2) because what you're doing should've triggered an assert regarding mCachedTransformOutOfDate.
We have a very similar known issue with v2's TagPoints.
As for your specific problem: We update the scene nodes, then the tagpoints. So if as a result of a listener you updated a scene node from a tagpoint, it is already too late, it won't be seen until next call to SceneManager::updateAllTransforms (which is usually next frame unless it's called explicitly).
A simple solution is to call node->_getFullTransformUpdated() to force the particular node to be updated. Calling _getFullTransformUpdated is not advised if you have a lot of nodes due to its performance hit, but if it's a few nodes it's not an issue. At one point the performance hit of calling many _getFullTransformUpdated per node surpasses the cost of calling updateAllTransforms.
Btw are you building in debug? (or set OGRE_DEBUG_LEVEL_RELEASE being >= 2) because what you're doing should've triggered an assert regarding mCachedTransformOutOfDate.