gravity force direction

   3862   2   2
User Avatar
Member
43 posts
Joined: April 2012
Offline
Hi. I want to make gravity force to be directed perpendicular to the grid, no mater which angle this grid is in the moment. I was trying to get gravity force normal, because if I correctly understand this is actual force direction. But I`m really stuck. There is a simple scene file to play with.

Attachments:
GravityOrientation.hipnc (241.7 KB)

User Avatar
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.

Attachments:
gravityorientation_123_jw.hipnc (620.9 KB)

There's at least one school like the old school!
User Avatar
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.
  • Quick Links