We’d like to make it possible for people to make spherical (or perhaps more interesting shapes someday) planets such that avatars and objects can fall in a radial gravitational field. We made some changes a few months ago to allow us to experiment with this for the avatar but we’ve hit a snag: non-uniform gravitational fields do not play well with our current entity gravity feature.
Right now gravity is a full Vec3 with <x,y,z> components and is set on a per-object basis. There is no rule that requires objects to agree on the fundamental direction of gravity. So how to make dynamic objects move correctly in a radial field?
It comes down to this: if we want to support non-uniform gravitational fields then the actual direction of gravity must come from an outside source: the world, or from a zone with a gravity setting. In this scenario the world or zone would say what direction is Up (and probably scaled by magnitude) and per-object gravity settings would be interpreted with respect to Up.
But this gives us three options:
(1) Reinterpret the Vec3 gravity property with a scalar (a single number) that represents the default magnitude (and direction according to sign) of the object’s gravity, but which will always be applied in the Up direction.
Pros: simplest to use
Cons: breaks scripts that try to use the X and Z gravity components
(2) Keep gravity as a Vec3 but ignore the X and Z components. The Y component would always be applied in the direction of Up.
Pros: simplest to implement
Cons: wasteful and puzzling
(3) Keep gravity as a Vec3 and also honor the X and Z components. In order to make this possible we would have to first rotate the vector into the local gravitational-frame such that the Y component is pointing along Up.
Pros: breaks no content
Cons: could produce unexpected results for objects that use the X and Z gravity components inside non-uniform gravitational fields
The question is NOT: Which option do you like the most?
The question IS: Does anyone know of existing content that actually uses the X or Z components of an object’s gravity? If so we’d like to hear about it.