• RuntimesBugs
  • 4.2 beta Runtime Physics Constraint behave differently from Editor

Runtime information

4.2 beta (Should apply to all current and future runtime update of physics constraint)

Problem statement

In general, my beta updated runtime physic constraints do not behave like the editor physics constraint. One easy difference is the application of wind or gravity to the physics constraint.

Troubleshooting statement

I debugged my beta updated runtime trying to find where the physics constraint misbehaved.
I stumbled upon if (remaining >= step) on:
EsotericSoftware/spine-runtimesblob/4.2-beta/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraint.java#L146
EsotericSoftware/spine-runtimesblob/4.2-beta/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PhysicsConstraint.java#L186

During my debugging, remaining variable is always 0 preventing the branches from executing. If I reverse the comparison to less than or equal, it allowed my runtime physics constraint behave like the editor physics constraint.

I don't see how the remaining variable is increasing beyond 0.

  • The reset method sets remaining variable to 0.
  • remaining -= step decreasing counter
  • remaining += Math.max(skeleton.time - lastTime, 0) always increasing by 0.

The skeleton.time doesn't seem to have any real use. I don't see skeleton update method being called in the runtime source.

public void update (float delta) {
	time += delta;
}

EsotericSoftware/spine-runtimesblob/4.2-beta/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java#L818

Even if I call skeleton update method with a delta greater than step in my rendering code before or after skeleton.updateWorldTransform(spine.Physics.update), the physics constraint doesn't look like in the editor.

In conclusion, I think this is a bug or I updated my runtime terribly wrong.

Related Discussions
...

Spine editor

if (remaining >= step)

if (remaining <= step)

Welcome to the wonder world of physics, where the smallest butterfly flaps its wings slightly differently and then nothing works. 😉

remaining is advanced by skeleton time since the last update:

remaining += Math.max(skeleton.time - lastTime, 0);

Skeleton update isn't called in the runtime because application code calls it (example). Pass the actual wall time that has passed since the last call to update.

Thanks you. It's working now with greater than (until I break it again 😅). I don't know what I did wrong; made too many changes trying to narrow down the cause. Is the skeleton viewer the only current example with the skeleton.update(time)?

Thank sneaky Harald! He does it on purpose!

2 mois plus tard

where exactly can try the physics beta? I have pro now

  • Nate a répondu à ça.