playMaker

Author Topic: How to implement "Slow Fall"? [SOLVED]  (Read 3408 times)

MarkD

  • Full Member
  • ***
  • Posts: 113
How to implement "Slow Fall"? [SOLVED]
« on: January 29, 2016, 01:38:58 AM »
I've been trying to implement a slow fall ability for my player.

I can use get property from the character controller to detect when the player is no longer grounded which I can use to trigger a new state when they're falling, but I haven't been able to slow the fall. 

I've tried using set property on my character controller, but anything under the "attached rigidbody" doesn't seem to have any effect.

Has anyone tried something like this or have any ideas?
« Last Edit: January 31, 2016, 01:46:30 AM by MarkD »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: How to implement "Slow Fall"?
« Reply #1 on: January 29, 2016, 02:50:35 AM »
If you have a rigid body with gravity on-

You can use the "Get Velocity" action and isolate the Y velocity with a float compare then adjust the rigid bodies gravity variable to slow falling- but I think the character controller might mess with that-

If you are using the character controller with a character motor script then you can use get motor velocity and use that to adjust the motors gravity- I'm using that technique on my current project and it works nicely-
« Last Edit: January 29, 2016, 02:52:53 AM by mdotstrange »
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: How to implement "Slow Fall"?
« Reply #2 on: January 29, 2016, 11:42:13 AM »
Thanks - I'll give that a try!  Would you mind if I pinged you for questions?

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: How to implement "Slow Fall"?
« Reply #3 on: January 29, 2016, 07:09:57 PM »
Feel free to post them in this thread as it might be useful for future searchers  :)
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: How to implement "Slow Fall"?
« Reply #4 on: January 30, 2016, 02:05:14 AM »
Ok, so here's what I have.



On my player, I'm only using simplemove and Character Controller to move around.  There's no rigidbody at all.




When the player picks up a glider, I send an event to the move FSM which is still using Simple move to move the player around, the only difference is that now I'm using Get Property from Character Controller to find out if the player is on the ground or not.  As soon as they jump or leave the ground, I send a transition.



In this "gliding" state, I'm again doing something similar with Simple Move, but I've tried setting the Y velocity to a positive and negative number in an attempt to slow the fall.  So far as I can tell, it does nothing at all.  I know that in the screenshot every frame isn't checked, but I've tried that already. :) 

Is there another property that I should be using? Or maybe a different character "motor" like you mentioned earlier?


mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: How to implement "Slow Fall"?
« Reply #5 on: January 30, 2016, 05:52:25 AM »
Simple move ignores any y values fed to it- I learned that the hard way myself  :)

What I was trying to do on my current project was close to gliding- it was for a jetpack so I needed to adjust the gravity- this is what I ended up doing

I'm using a C# version of the Character Motor script thats been floating around forever because it allows you to do jumping in a 3d game really easily in a nice way without using Rigid Bodies/force- so on my character I have a CHaracter Controller and Character Motor script


The character motor has its own gravity setting- I use the attached Set Motor Gravity action to adjust the gravity-

I attached the character motor script and a character motor PM action as well- you can adjust the gravity with that too-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

MarkD

  • Full Member
  • ***
  • Posts: 113
Re: How to implement "Slow Fall"?
« Reply #6 on: January 31, 2016, 01:46:15 AM »
Ok - this is pretty fantastic!  I've got a lot of tweaking to do, but this is exactly what I needed.  Thank you so much!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: How to implement "Slow Fall"? [SOLVED]
« Reply #7 on: January 31, 2016, 01:49:37 AM »
Glad it was helpful :) the Character Motor script is pretty old but I still find it very useful-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!