2

Scripted physics features

Despite great progress I'm making, I'm realizing there's a limit to the dynamic motions I can do right now with physical objects. Here are some requests.

Body.GetCenterOfMass(). This would return a vector reflecting the offset from the object's origin of the center of mass/gravity computed during build time.

Body.AddLinearImpulse(Vector Impulse, Vector Offset). This is an overload of the existing method, with the addition of the Offset vector, which is relative to the object's origin and current orientation. This impulse would, if offset is not a zero vector, apply torque around the object's center of mass in addition to imparting a linear impulse to the body. This is a standard feature of classical statics and dynamics. This could be applied to applications like twin-engine airplanes, quad-copters, objects dangling from ceilings, chains, and more.

Body.SetBuoyancy(Vector Mass).  As requested in an earlier post, I'd really like this as a way to drastically reduce the jitter that comes with constantly trying to oppose the constant pull of gravity in our scenes. For the most part, I can get an airship to appear to be perfectly, smoothly stable in the sky, but every now and then, there's a blip when the thing falls a little and then gets fixed again.

  https://gyazo.com/546ecbe2a979afa9da14415e051cb95f

And an avatar on deck will show some unnatural jittering, too.

  https://gyazo.com/68768777e7492ab480abdb41b702922c

Being able to exactly counter the mass of a floating object (and possibly its occupants) would allow scripts to have way fewer updates and thus CPU time. For a slow-moving hot air balloon, updates might happen once per second instead of 50 times per second.

I would argue that every one of these three requests should be easy to implement with very little added code and essentially zero impact on CPU, memory, and network resources.

8 comments

Please sign in to leave a comment.