gravity force direction
3862 2 2-
- miklem
- Member
- 43 posts
- Joined: April 2012
- Offline
-
- old_school
- Staff
- 2540 posts
- Joined: July 2005
- Offline
If I understand you correctly, you want the orientation of the grid to drive the gravity direction? The tricky part of your scene is that everything is hung off a Null with a transform on it. Not that tricky really.
In the attached scene file I created a new Null Object that fetches the geometry from your grid geometry with no parent but set the Transform space to be “this object”. This causes the world transform to be baked in to the geometry.
Now for the Gravity Direction, it is a simple matter of picking on any primitive that has the correct direction then use the prim() function to grab that primitive's N normal and pass that in to the three axes for your gravity. Then negate it.
See your reworked example file.
There are other ways to grab prim orientations as a direction vector but this one is pretty straight forward and shows you one use of the Object Merge SOP to bake in Object transforms in to geometry.
In the attached scene file I created a new Null Object that fetches the geometry from your grid geometry with no parent but set the Transform space to be “this object”. This causes the world transform to be baked in to the geometry.
Now for the Gravity Direction, it is a simple matter of picking on any primitive that has the correct direction then use the prim() function to grab that primitive's N normal and pass that in to the three axes for your gravity. Then negate it.
See your reworked example file.
There are other ways to grab prim orientations as a direction vector but this one is pretty straight forward and shows you one use of the Object Merge SOP to bake in Object transforms in to geometry.
There's at least one school like the old school!
-
- miklem
- Member
- 43 posts
- Joined: April 2012
- Offline
Jeff, thank you! This is exactly what I want! Thanks for explanation, it really clarifies workflow. I need to play with functions much more.
The only thing now is that it`s necessary to multiply this
-1*prim(“/obj/GravityOrientation”, 0, “N”, 0)
to for example like this
-5*prim(“/obj/GravityOrientation”, 0, “N”, 0)
to get control about force amount. If I would calculate vector lenght, then I`ll get a number. It`ll work like a force amount indicator, right?
—
upd
Okay, I got it. Multiplication gives a force amount. So if I multiply it to 9.8 then it`ll work like correct gravity.
The only thing now is that it`s necessary to multiply this
-1*prim(“/obj/GravityOrientation”, 0, “N”, 0)
to for example like this
-5*prim(“/obj/GravityOrientation”, 0, “N”, 0)
to get control about force amount. If I would calculate vector lenght, then I`ll get a number. It`ll work like a force amount indicator, right?
—
upd
Okay, I got it. Multiplication gives a force amount. So if I multiply it to 9.8 then it`ll work like correct gravity.
-
- Quick Links

