Search Unity

questions aboot PlatfomerContoller

Discussion in 'Scripting' started by rufalo, Feb 23, 2010.

  1. rufalo

    rufalo

    Joined:
    Feb 12, 2010
    Posts:
    5
    hi
    i have bean looking though the 2dplatormer tutorial
    PlatformerContoller.js File and i am wondering
    how does that make the character move
    i dont see any Translate actions

    and i was wondering if it moves using the @script RequireComponent (CharacterController)?

    im trying to write my own characterContoller script and trying to apply gravity to the player is getting kinda confusing
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    The CharacterController does indeed move the player using the Move or SimpleMove functions. Creating gravity involves adding a downward component to the movement vector that you apply to the controller. The PlatformController.js script shows how to do this - note especially the ApplyGravity function.