Announcement

Collapse
No announcement yet.

Gravity Vectors / Point Gravity / Cylindrical Gravity

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Gravity Vectors / Point Gravity / Cylindrical Gravity

    I noticed in the UE4 Trello that there is a BodyInstance & PhysicsVolume gravity settings card. From the description, I'm assuming that this will change the hard-coded "GravityZ" to an arbitrary vector. I was wondering if this would also include support for point gravity and cylindrical gravity (the ability to walk on the inside/outside of a cylinder). If not, is this something that the community could contribute?

    #2
    Originally posted by threadlock View Post
    I noticed in the UE4 Trello that there is a BodyInstance & PhysicsVolume gravity settings card. From the description, I'm assuming that this will change the hard-coded "GravityZ" to an arbitrary vector. I was wondering if this would also include support for point gravity and cylindrical gravity (the ability to walk on the inside/outside of a cylinder). If not, is this something that the community could contribute?
    GravityZ is a basic feature provided by PhysX. If you want to generate point gravity you need to disable gravity on the actor (or just set global gravity to 0). Then all you need to do is provide your own force of gravity to each body.

    Point gravity is simply

    Gravity = 980
    GravityVector = (LocationOfGravitySource - LocationOfActor).Normalized()
    Actor.AddForce(GravityVector * Gravity)

    This is just pseudo code, but you can do this from a blueprint if you want no problem as well.

    If you want to do something similar for a cylinder

    You'd need to compute the appropriate GravityVector and you're good to go.

    / Kyle
    @kylerocha
    Luminawesome Games
    http://luminawesome.com/

    Comment


      #3
      It's not too hard to add your own gravity forces, but it's a bit harder to get your character to walk on a cylinder. The existing implementation of the character controller is always Z-up. There is another card on the road map to allow for arbitrary character orientation, and the author of the Adventure Kit here on the forum has apparently been developing this as well. So it looks like support for different gravity vectors is coming at some point, but it's always hard to predict when.

      Comment


        #4
        The best thing to do is upvote the trello cards you care most about.
        @kylerocha
        Luminawesome Games
        http://luminawesome.com/

        Comment


          #5
          Originally posted by CaptainScience View Post
          It's not too hard to add your own gravity forces, but it's a bit harder to get your character to walk on a cylinder. The existing implementation of the character controller is always Z-up. There is another card on the road map to allow for arbitrary character orientation, and the author of the Adventure Kit here on the forum has apparently been developing this as well. So it looks like support for different gravity vectors is coming at some point, but it's always hard to predict when.
          Yeah, you're right, gravity is not the difficult part. I guess what I was asking for was arbitrary character orientation. Thanks for the link!

          Comment

          Working...
          X