Jump to content
  • Advertisement
Sign in to follow this  
Icebone1000

Fixed Step - Interpolating positions, trafo hierarchies and snapping to position

This topic is 2140 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Say you have a fixed step game loop, and youre interpolating positions just like that "Fix your time step" article.

 

Now say you have a transform hierarchy (world transforms that are computed from parent transforms and local transforms).

 

What I do Is interpolate previous world with current world (when current world != render world ). Works like a charm.

 

So I keep local, world and previous world, the render world is separated, with the render stuff.

 

What do I do if I want to snap to a position, with no interpolation? I cant set previous world by hand, because I only mess with the local transform (what if the parent change?)  I cant even think on what Id need to do to achieve that..Its confuse.

 

What should I do?

Share this post


Link to post
Share on other sites
Advertisement

Set the new position and then set the previous position to match it.  You say you can’t, but you can.

 

Although that is the correct way, if you still refuse to manipulate the previous position for whatever personal reason, add a flag to tell it not to interpolate and just use the current position until the flag is reset (which would be on the next logical update).

 

Parent transforms are unrelated to this problem.

 

 

L. Spiro

Edited by L. Spiro

Share this post


Link to post
Share on other sites

I went to the flag, a bool...It works, but I dont have any parent for my current situation.

 

You say you can set by hand and parents are unrelated, but those are world transforms.. Theoretically you will have to compute all hierarchy by hand to be able to set the worlds so it do not conflict with the correct world that will be computed in the next logical step.

What if the world you set doesnt match the automatic computed world next step?

 

The intuitive thing would be to snap the local transform, but that doesnt make any sense for the rendering logic.

Edited by Icebone1000

Share this post


Link to post
Share on other sites

I don’t see how this is related to render interpolation.

If you want to set a world position on a child node then you have to set a local transform on the child that gets it into the correct world position based off the parent’s world position.

Which is simple:

Child.Local = AbsWorld * Inverse( Parent.World ).

 

With either a flag or setting the previous to the same as the current world transform the object will instantly be at the new position until the next logical update.

I don’t see the conflict here.  Interpolating for rendering is completely unrelated to the parent/child relationship/scene graph.

 

 

L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!