Climbing bug, stuck in the air.

^^^^^ first part shows it all “working” (be it without Lerping…) second part, not working. then a slow-mo of what’s going on ingame.
don’t mind the part where the character gets sucked down, the controllers bottom moves to the transform of the ball, and I’ve done the animation so that the character moves down to it’s root. probably redo that, but that is not the issue :slight_smile:

want to Lerp into a climb position when hitting the trigger. right now goes into “in-air”-state.
probably because the controller isn’t grounded. is there a way to tell the controller it is grounded? (read only…?)

I want to be able to attach to parts of my level, like you would do in say inFamous or the like (but without the shimmying along ledges).

Got a sphere that I can place where I want to be able to climb, that triggers the animation and places the character at the center of the sphere.

The problem I have, is that it only works some times.

And when it doesn’t work, the character gets stuck in it’s “in-air”-state.

The part that should interest you the most is the last part of my main script called “states”:

var target : Collider;
var climbPos : Transform;
var start : Transform;
var end : Transform;

function OnTriggerEnter (trigger : Collider) {

var controller : CharacterController = GetComponent(CharacterController);

movement = GetComponent(“UnityMovement”);

states = GetComponent(“States”);

additiveBlend = GetComponent(“AdditiveTest”);

climbing = GetComponent(“Climbing”);

if (trigger == target)
    animation.CrossFade("climb_land", 0.3);

    transform.position = Vector3.Lerp(start.position, end.position, 5.0);
	additiveBlend.leanRight.weight = 0;
	additiveBlend.leanLeft.weight = 0;
   	states.enabled = false;
    movement.enabled = false;
    climbing.enabled = true;


function OnTriggerExit (trigger : Collider) {

movement = GetComponent(“UnityMovement”);

states = GetComponent(“States”);

climbing = GetComponent(“Climbing”);

if (trigger == target)
    print("exit climb!");
    transform.parent = null;
    states.enabled = true;
    movement.enabled = true;
    climbing.enabled = false;


I can assume that part of the problem is that when the controller isn’t grounded, I play the “in-air” animation…
Is there a way to switch the grounded to true even though it … isn’t ?

When in the climb state, I don’t want to be able to move around (running and such) and therefore I disable all the scripts associated with that.
This of course also turns of the main script <_<, but I’ve even tried having it so that you can jump out of the climb state and having it all re-enable, which is kind of what I want.

But I might (should anyways…) have to put the climb part into it’s own script, that could help?

My scripts are very messy at the moment, I’m basically just trying to implement my crazy ideas and hopefully get around to solving it better later :stuck_out_tongue:
the entire script, the collision checks are at the bottom

Thank you!

Right now it’s fun and all to jump around on the rooftops, but once you’re down there’s no way to get back up! :slight_smile:

var blendSpeed : float = 0;
var blendValue : float = 0;

blendValue += blendSpeed * Time.deltaTime;

transform.position = Vector3.Lerp (climbLocStart.position, climbLocEnd.position, blendValue);

transform.rotation = Quaternion.Lerp (climbLocStart.rotation, climbLocEnd.rotation, blendValue);

that’s what I hacked together with the help of a friend and what whydoidoit said!
the character blends into the climb position now!

there are times where it bugs out and the character gets stuck in the air… but I’ll take care of that later :slight_smile:

got to reset the blendValue after jumping now…hmm