playMaker

Author Topic: Problems with physics-based movement  (Read 2507 times)

evilAlfredo

  • Playmaker Newbie
  • *
  • Posts: 2
Problems with physics-based movement
« on: April 26, 2015, 09:17:57 PM »
I'm currently working on a 2D platformer, but I've run into a big roadblock. My previous movement system used Get Axis and Set Velocity 2D to move the player left and right. This worked fine... Except when outside forces needed to affect the player.
I've tried a few workarounds now, such as making a state that had no such set velocity, for whenever they were being pushed. The issue with that, was that as soon as they exited that state, it would immediately set the X velocity to 0 and stop any momentum.
The solution I'm currently working on, is to use Add Force 2D instead, but that brings its own problems. Since Force is a constant acceleration, it quickly gets to obscene speeds. I can't figure out how to actually limit that speed with the clamp actions available. I also need to decelerate back to zero when there is no input, but drag makes it feel like walking on ice.

Can anyone help me find a solution for this? Ideally, my goal is to have snappy left and right movement that can be affected by outside forces. I've tried all I know to do, and keep hitting barriers. I don't have much coding knowledge either, so Playmaker is all I really know how to use. Any help at all is appreciated.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Problems with physics-based movement
« Reply #1 on: April 27, 2015, 06:37:20 AM »
I've been working through the same issues on a 2.5d platformer- what I ended up doing is using the "translate" action to move the character- I multiply the input vector3's and adjusted gravity/mass to get the feel I wanted- the character just has a capsule collider and rigid body using gravity- here's some screenshots of the fsm that moves the character
]http://i.imgur.com/KAhycjw.png[url]http://i.imgur.com/SpTZrgP.png[/url]

And here's the force that makes the player jump http://i.imgur.com/nDTD25T.png

Here's the collider/rigid body settings on the player http://i.imgur.com/DKsIWyB.png

Hope that helps
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!