Search Unity

Character Motor not working properly.

Discussion in 'Scripting' started by ArrayCS, Sep 18, 2017.

  1. ArrayCS

    ArrayCS

    Joined:
    Sep 18, 2017
    Posts:
    29
    So when I go to my character motor and change the speed. the speed doesnt change at all. i want to change the speed because my character is going SO slow. i've tried changing it in the unity thing and i've also tried changing it in mono develop. this is the code i've put in (Only the first like 100 lines)

    #pragma strict
    #pragma implicit
    #pragma downcast

    // Does this script currently respond to input?
    var canControl : boolean = true;

    var useFixedUpdate : boolean = true;

    // For the next variables, @System.NonSerialized tells Unity to not serialize the variable or show it in the inspector view.
    // Very handy for organization!

    // The current global direction we want the character to move in.
    @System.NonSerialized
    var inputMoveDirection : Vector3 = Vector3.zero;

    // Is the jump button held down? We use this interface instead of checking
    // for the jump button directly so this script can also be used by AIs.
    @System.NonSerialized
    var inputJump : boolean = false;

    class CharacterMotorMovement {
    // The maximum horizontal speed when moving
    var maxForwardSpeed : float = 60.0;
    var maxSidewaysSpeed : float = 60.0;
    var maxBackwardsSpeed : float = 60.0;

    // Curve for multiplying speed based on slope (negative = downwards)
    var slopeSpeedMultiplier : AnimationCurve = AnimationCurve(Keyframe(-90, 1), Keyframe(0, 1), Keyframe(90, 0));

    // How fast does the character change speeds? Higher is faster.
    var maxGroundAcceleration : float = 30.0;
    var maxAirAcceleration : float = 20.0;

    // The gravity for the character
    var gravity : float = 10.0;
    var maxFallSpeed : float = 20.0;
     
  2. johne5

    johne5

    Joined:
    Dec 4, 2011
    Posts:
    1,133
    your code tells us nothing. These are just a bunch of variables.

    So When you say you change the speed, I assume you change these
    var maxForwardSpeed : float = 60.0;
    var maxSidewaysSpeed : float = 60.0;
    var maxBackwardsSpeed : float = 60.0;