Announcement

Collapse
No announcement yet.

Make A Ball Roll Forward Regardless of Surface Normal?

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

    Make A Ball Roll Forward Regardless of Surface Normal?

    I'm trying to make a rolling ball game. I need the ball to roll towards the camera forward vector on any surface normal. Can anyone help me figure out the script?

    #2
    Do you need any kind of true physics? A kinematic alternative would be to use a normal character, configure it to being able to "walk" on steep slopes, and animate the rolling based on the change in location each frame.

    Comment


      #3
      Unfortunately, the ball's movement uses true physics and has to stay that way

      Comment


        #4
        unfortunately "true physics" and "roll towards the camera forward vector on any surface normal" are mutually exclusive conditions.

        As HavocX suggested, in order to roll towards the camera forward vector at a uniform speed and on any surface normal you will probably need to implement a kinematic alternative.


        As a potential experimental alternative, you could experiment with constantly applying a force to the ball towards the camera, and increase/decrease the force applied to compensate for steeper slopes.

        For example, continually increase the force until there is positive velocity toward the camera.

        However, this will result in non-uniform acceleration towards the camera and may be difficult to control e.g. some balls will be faster than others depending on slope traversed.
        https://www.casualdistractiongames.com

        Comment


          #5
          I have not tried this myself but might be worth testing,

          under your objects Physics tab you might have an 'constraint' option. Try changing the mode to 'Custom Plane' and feed in some dynamically updated numbers that represents the plane cutting through your view forward. If you're lucky maybe it'll make a sort of '2D physics' constrained to that plane?

          EDIT: Or could you just work out the world vector pointing sideways from your camera view and then use that to multiply objects' velocities to zero in that dimension?

          EDIT2: Reading your question more carefully, another hacky way might be to take the camera forward / ball rolling direction and sample the ground normal a bunch of times along that direction and then average those normals to give you a sort of 'average slope'. You could then maybe disable Unreals own gravity and replace with a force angled towards your new average normal?
          Last edited by Fredrum; 01-13-2017, 06:31 PM.

          Comment


            #6
            You can also try the Custom Gravity Plugin found here - https://forums.unrealengine.com/show...ls-amp-Plugins


            It would basically allow your ball to "stick" to any surface by changing the gravity based on the surface normal.
            [WIP] Procedural City Generator | RPG AI
            [MARKETPLACE] Animal Behavior Kit | Space Shooter Template | Procedural Foliage Tool | Procedural Park
            [FREE] Modular Road Tool | Action Platformer Template | Radar BP | Free Birds | Procedural Buildings
            Join our Discord

            Comment


              #7
              hi! I did (and am still doing) a tutorial serie on a rolling ball mini game. I'm sure you can find these videos to be very informative

              https://www.youtube.com/watch?v=-xTB...1KJsd0iURjEBvO

              Comment

              Working...
              X