Search Unity

Gluing rigidbody to a wall

Discussion in 'Scripting' started by StridingDragon, Feb 19, 2017.

  1. StridingDragon

    StridingDragon

    Joined:
    Jan 16, 2013
    Posts:
    78
    I've been trying to create a script that allows the player to climb in a third-person view. However, I can't seem to figure out how to do this. Whenever there is no upwards movement, gravity pulls the character back down to the ground.

    I tried all sorts of things, turning off gravity for the rigidbody, applying an opposite force, but nothing seems to work. I also tried to put regular object underneath it to create some sort of an elevator but when I move it downwards, the application of gravity and the inertia make it look weird.

    Can someone please tell me what I'd have to do to glue a character to a certain spot and stay there, regardless of whether seems to be in the air or not?
     
  2. KristoE

    KristoE

    Joined:
    Oct 13, 2012
    Posts:
    90
    How can the gravity affect the rigidbody when you have turned it off?
    When and how did you turn the gravity off? Does turning off the gravity make any difference or is it just the same?
     
    StridingDragon likes this.
  3. StridingDragon

    StridingDragon

    Joined:
    Jan 16, 2013
    Posts:
    78
    You are absolutely correct… how could it? Hmmmhh… I need to check my code again. I guess there is something or someone else applying a force on it.
     
  4. StridingDragon

    StridingDragon

    Joined:
    Jan 16, 2013
    Posts:
    78
    Well, this was clearly a case of not seeing the forest for the trees. LOL
    Thanks again, Kristo for making me see. I finally found the problem.