How would i be able to lerp this ?
transform.position = new Vector3(ladderPos, transform.position.y, Time.deltaTime *toladderinseconds);
no lerp takes place, no toladderinseconds takes place.
it just snaps to the ladder.
Maybe using Vector3.Lerp, but it don`t allow floats ?
My full code is this for anybody intrested
private void LadderClimbLogic()
{
float laddtime = 3f;
if (isClimbing && isLadder)
{
rb.gravityScale = 0f;
rb.velocity = new Vector2(rb.velocity.x, yAxis * climbSpeed);
transform.position = new Vector3(ladderPos, transform.position.y, Time.deltaTime *laddtime);
rb.constraints = RigidbodyConstraints2D.FreezeRotation | RigidbodyConstraints2D.FreezePositionX;
if (xAxis > 0 && Input.GetButtonDown("Interaction") || xAxis < -0 && Input.GetButtonDown("Interaction"))
{
{
isClimbing = false;
IsClimbingMove = false;
isLadder = false;
canMove = true;
isJumping = true;
isWalking = false;
}
}
}
else
{
rb.gravityScale = startingGravity;
rb.constraints &= ~RigidbodyConstraints2D.FreezePositionX;
if (canMove)
{
canDash = true;
}
}
}