Simulated Animation Effects Week#5

I’ve started past week by going over my implementation of simulated animation effects and getting rid of the rough parts, so it would be somewhat ready to be merged into LO master. While doing so, realized I’ve forgot to add support for other types of ongoing animations in parallel with a simulated animation.

So to implement this, I thought all animation instances would have a reference to box2DWorld, if box2DWorld is initiated (as in there’s a simulated animation going on), these animations would supply box2DWorld with required information on how to update shape corresponding to this animation instance. The information supplied would have the uno shape reference of that animation effect, type of the update box2DWorld will perform (change position, appear/disappear, change size etc.), and if required any additional info (for instance, if it is an path motion animation, it would supply the updated position of the shape).

box2DWorld would hold all incoming information in a queue so that it can process this information before stepping through the simulation.

So far I’ve only implemented this for path motion animation effects – since my finals have started last week, and they are slowing down my progress :/ –

For the instance of path motion animations, when there’s an position update it doesn’t make sense to just change the position of the shape (teleport) in box2DWorld, even though this would make it push shapes out of it’s way, the end product wouldn’t seem “simulated” since the body didn’t have any velocity. To fix this problem, positions of the shapes are updated by calculating linear velocity required to make the shape travel to the desired position in the delta time box2DWorld will step through. And then assigning this linear velocity to corresponding body. This results in convincing simulations that have a higher degree of realism.

Here’s a small demo illustrating this in action:

Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.

check out the source on the private experimental branch: gsoc-box2d-experimental