Anybody use X and Z components of gravity?


#1

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.


#2

I only know a couple of scripts that I think use the X and Z components of gravity in HiFi,

But I wonder about 1, 2 and 3 on your list because what I would rather see is a per entity gravity Vec3 origin and Scalar value that could both be changed with the script API.

Without something like this, I think it would be hard to easily make planets you could walk around or realistic vehicles that would mimic real life physics.

I’m not sure this is even doable but I’d rather have a slow update now than be locked into something that can never get better.


#3

I would say no1… If some things have to be broken to make a better system, I think the sooner is the better.
Such things will be difficult to change later.

But tell me, how is that going to work?
The zone orientation will define where will be the UP ?

Do you plan to support different gravitation mode for a specific zone?

  • Linear (from the base plan)
  • Radial (from the center)
  • Inverted Radial? (from the opposite of the center… walking on the wall inside a sphere)
  • Radial cylindric? (from a line… walking ion a cylinder)
  • Inverted Radial cylindric? (from the opposite of a line… walking on the wall inside a cylinder)

If I understand well an entity would follow the gravity sets for the effective zone where it is included?

Seen like I imagine it that would be a very very interesting feature… Please, someone, pop my balloon quickly if it is not that. :wink:


#4

Only time I see the use for the other components gravity is when trying to experiment with simulating radial gravity:

I do welcome better systems for it though, and right now would be a good time to do so:

I dont know anything actually using it other than simulating the downward or upward force, so migrating this to an “external” gravity (points of gravity sources) would probably be better overall, requiring less work…


#5

Please break whatever you need to in order to make this happen. :+1:


#6

I have used Y gravity extensively, I have used all 3 axes of velocity in various applications.

I have never found the need to use X or Z gravity and don’t believe I have ever seen a script using other than Y gravity.

TBH I never knew why there were the other axes of gravity. I am totally ok with this idea, I visualize being able to walk continuously upright looking ahead while the system auto gravitates me and always points me up, just like a real planet. That’s an awesome image. So long as we can also have default plane gravity if we wish.

Thanks for throwing this out to the community, its refreshing and comforting to be able to add feedback to the development.


#7

The title and discussion helps users understand the root mechanics at play. Everyone is familiar with the concept of gravity. I would like to make the recommendation that IF you wish to reduce the force of gravity to a scalar or manipulate it in some fashion; please offer an example of additional applied force be it drag, or electromagnetic, or anything. It isn’t really ethically ‘fair’ to request users expose a need for pre-existing content if that user isn’t exactly ready to discuss such content. That is why it is referred to as a ‘spoiler’ :wink:

To recap: it would be super fantastic to have the physics overhauled, and I don’t have anything meaningful to add outside of my own recommendation for added forces. I can’t give exact examples but I can come up with a few situations where having the ability to add an external force upon an entity that is completely unbound to ‘gravity’ would be fantastically useful.

Please keep that in mind. Please and thank you. :smiley:


#8

Seems like heracy to me everone knows the metaverse is flat


#9

Nah, we are just thinking in limited 3 dimensions.

We should be thinking


#10

I wish we could have different types of zones:

  • Ambient (skybox, global light…)
  • Gravitational
  • Audio
  • Visibilty (to limit what the user can see, that will allow us to run different setup on a same domain)

Have the ambient and the gravitational affecting the same zone is not going to make things easy to use.


#11

A 12km radius planet would make us a little 75km X 75km land without any edge… I can’t wait to see that :wink:


#12

#13

Why? is someone asking for this? Is there a real use case that needs this? Seems like little bang for the buck…

-W


#14

Give it to me , I’m going to make a real use case of this :wink:


#15

Very much so from here, too!


#16

I think it’s fairly compelling to have spherical constructs we could walk upon - given the space we have and some creative use of scaling… could simulate some fairly large bodies… maybe a nice asteroid that can break the rules and spin up 1G but not fly apart. Leaving the world of planes with bumps to worlds of complex shapes is something I’ve always hoped to see. Considering the possibilities such would offer… it would be a massive leap over flat(ish) worlds.


#17

I use XYZ gravity for several pet projects, including one for “skipping stones across a pond.”

Gravity provides a way to simulate something like momentum and seems to allow more people to see smooth results more of the time – while still letting an object occasionally bounce on stuff, etc.

I know I’m using gravity as a workaround though. In theory Actions would work better, but they don’t yet (for multi-user scenarios). I suspect more scripters than on this thread are also using gravity to apply a constant force. Perhaps the current field could be renamed [something better than] “momentum” and remain an option [that basically means “try to keep going in this direction”] next to Y-up gravity.
[note: edited per feedback]


#18

I Use XYZ Gravity in my music visualizer effects. I think it would be better if we could define gravity entities that can attract or repel and can have a falloff setting.
Other entities could have a setting to repond to gravity entities, only repond to a specific gravity entity, or not at all.

Perhaps also a special gravity mode where you could define the radius of the gravity entity such that you could define several at the same point with different radiuses with different gravitational settings that work from the inside out. so we could make a destracted globe like in ready player one where you can walk on the inside of the sphere, or jump up into another zone that has nul gravity.


#19

Not sure that “Momentum” is the good term for that.
Momentum (p = mv), for what I know, has to do with the energy exchange when entities are colliding

But if I’m not wrong, there is an "acceleration "vector on the entity that can help… but this would need to be coupled to a “antigravity” magnitude on the entity. (It would be fun to be able to have object able to float or climb.)

I would the replace the XYZ vector by a magnitude opposable to the gravity. (on the entity)

Otherwise, we might have a hard time to figure the opposite “acceleration” vector in a radial gravitational field to make something floating… it might behave weirdly when the entity is moving if this is calculated in a js script.


#20

I think we need that.