My demo is below, but first my explanation. I’m building a real time networked game that requires physics. I run the game simulation both in the browser, and in a node backend server using NullEngine. Everything seems to work, except the exact same physics configuration in NullEngine and Engine are completely inconsistent.
With NullEngine physics, the boxes seem to slide into each other, and perform some odd ball settling looking physics. The worst is that the rigid bodies will completely intersect each other for periods of time before rejecting each other slowly. This does not at all happen on the normal Engine.
I’ve reproduced the same issue inside babylon playground using null engine. Since playground limits the size of the demo, grab the pastebin and paste it into the playground.
Steps to Reproduce
Grab the left textured box with your cursor, slam it into the right textures box and play around with it. It feels good and right
Grab the left untextured box (from the null engine) and slam it into the right untextured box. The physics do really really really weird stuff.
My entire startup hinges on getting this right, so I’m deep in debugging on why this is broken. I’ll definitely report back, and perhaps even recommend a pull request if I can find out why this is happening. If you, or anyone has any idea to help me along the way I would sorely appreciate it.
ok yes… rotation is totally broken and not being updated in the null engine for some reason. rotationQuaternion does seem to work. http://www.giphy.com/gifs/Pj5mczIq0LIKbieYWz. It looks like the quaternion isn’t marked as dirty so it’s never syncing over to rotation. I thought this might be a me problem, but i’m 100% convinced I’ve run into a babylonjs bug now.
Adding @RaananW who is fantastic both with physics and null engine would you have a smaller repro of the issue ? it might help a lot troubleshooting faster.
The rotation parameter is reset once using a physics engine, and only the rotationQuaternion is updated. This is not an issue but a feature of the framework - once you have a quaternion defined, the rotation will no longer be used.
That makes sense as an explanation to the problem. Thanks for explaining that.
It looks like from an outside who hadn’t seen this explained that, this is a very very easy issue to run into without understanding what the issue is. I don’t have a recommendation, just that I wish I had found this information a bit more easily.
@RaananW, @jason.spafford it seems that this warning still applies within the null engine. The warning also remains if the rotation values are set indirectly rather than using mesh.rotation = … I will strengthen the warning.