Search Unity

How to apply physics to a player using 'Character Controller'

Discussion in 'Scripting' started by gilson, Dec 16, 2010.

  1. gilson

    gilson

    Joined:
    Sep 13, 2010
    Posts:
    36
    Hi everyone, im having some problems applying physics to a player. I want to put the player in the bottom of a seesaw and after a object falls on the other side of the seesaw, it will throw the player to the desired direction. Since im use character controller, the physics doesnt apply by itself. Anyone has any sugestions of how to do this? I also wanna make my character being abble to swing in ropes...

    I would appreciate any sugestion or code examples that could help me.

    Thank you
     
  2. renton_u3d

    renton_u3d

    Joined:
    Oct 26, 2010
    Posts:
    9
    character controller includes physics collider already..
     
  3. gilson

    gilson

    Joined:
    Sep 13, 2010
    Posts:
    36
    But i want to know, how to apply a physical force. Like, i get hit by a cannon ball, or someone 'press' the other side of the seesaw and throw me out, you know?
     
  4. Nikolay116

    Nikolay116

    Joined:
    Mar 21, 2010
    Posts:
    421
    well I guess it is easier to make your custom CC based on rigidbody
     
  5. gilson

    gilson

    Joined:
    Sep 13, 2010
    Posts:
    36
    Is it possible to switch between character controller and rigid body? One time i wont get thge physics applyed to me and some other time it will?
     
  6. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    It is possible to keep a rigidbody on a character controller object with the Is Kinematic option switched on. This effectively disables the physics until you switch it off again. You could disable the character controller and enable rigidbody physics just before throwing the player with the seesaw. Then, as the player lands, reenable Is Kinematic and the character controller and you will get normal control again.