- Home /
Stoping character with Platformer Controller script attached. 2,5D ladder.
Hi. I want to make climbable ladder. I have code like that:
var ladder : Collider; var onLadder = false;
function OnTriggerStay (ladder) { if (Input.GetAxis("Vertical") > 0){ onLadder = true; } }
function OnTriggerExit (ladder) { onLadder = false; }
function FixedUpdate(){ if (onLadder){ PlatformerControllerMovement.velocity = Vector3.Slerp(PlatformerControllerMovement.velocity, Vector3.zero, 1); PlatformerControllerMovement.gravity = 0; } }
But it doesn't work. I want to stop the character, but it only slows.
What should I do to stop the character imedietly?
Answer by Molix · Apr 15, 2010 at 07:10 PM
The third parameter in Lerp/Slerp is a number from 0 to 1. In your code it is always 0, meaning it will always return the first parameter.
It's the same effect with the third parameter set to 0.25, 0.5, 0.75 and 1.
If you set the velocity to 0 (Vector3.zero) here, and it is still moving, then it must be set to non-zero somewhere else, e.g. does your PlatformerController$$anonymous$$ovement script know to stop moving the character?
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Contrain movement along x axis 1 Answer
2D Platform game ladder climbing 1 Answer
Side scroller - rotate object towards player. 1 Answer
Health subtracts when hit by bullit 2 Answers