- Home /
tring to make a jump pad in fps
i know there is somthing wrong with this script i have edited but im not sure what is wrong with it?
private var motor : CharacterMotor;
// Use this for initialization function Awake () { motor = GetComponent(CharacterMotor); }
// Update is called once per frame function Update () { // Get the input vector from kayboard or analog stick var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
if (directionVector != Vector3.zero) { // Get the length of the directon vector and then normalize it // Dividing by the length is cheaper than normalizing when we already have the length anyway var directionLength = directionVector.magnitude; directionVector = directionVector / directionLength;
// Make sure the length is no bigger than 1
directionLength = Mathf.Min(1, directionLength);
// Make the input vector more sensitive towards the extremes and less sensitive in the middle
// This makes it easier to control slow speeds when using analog sticks
directionLength = directionLength * directionLength;
// Multiply the normalized direction vector by the modified length
directionVector = directionVector * directionLength;
}
// Apply the direction to the CharacterMotor motor.inputMoveDirection = transform.rotation * directionVector; motor.inputJump = Input.GetButton("Jump");
} function SuperJump (height : float) { verticalSpeed = CalculateJumpVerticalSpeed (height); collisionFlags = CollisionFlags.None; SendMessage("DidJump", SendMessageOptions.DontRequireReceiver); }
function SuperJump (height : float, jumpVelocity : Vector3) {
Answer by Meltdown · Dec 14, 2010 at 01:38 PM
Have you looked at the 3rd Person Platformer tutorial?
In there they have jump pads. Maybe you can work out whats going wrong by looking at the code in that script.
yeah i have dont that but i still dont see the problem. these are the 2 errors i get 1: Assets/Standard Assets/Character Controllers/Sources/Scripts/FPSInputController.js(33,25): BCE0005: $$anonymous$$ identifier: 'CalculateJumpVerticalSpeed'.
2: Assets/Standard Assets/Character Controllers/Sources/Scripts/FPSInputController.js(40,25): BCE0005: $$anonymous$$ identifier: 'CalculateJumpVerticalSpeed'.