Question by
devintbarrett · Nov 23, 2020 at 08:02 PM ·
c#animationunity 5scripting problemvector3
How too climb a ladder with the FPS Controller correctly
Basically When I walk up too the ladder my character shoots up, but I would like the character too take their time with going up the ladder. Is that possible, I'm using a character controller & a rigidbody.
This is my script I use for the Ladder.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class LadderClimb : MonoBehaviour { public GameObject Player;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player" && Input.GetKey(KeyCode.W))
{
Debug.Log("Climbing Ladder");
Player.transform.Translate(Vector3.up * Time.deltaTime);
}
}
void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == "Player")
{
Debug.Log("ClimbedLadder");
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How to get the angle to animate the player when running? 0 Answers
Animation/Movement Error 1 Answer
Child class cannot access property in method? 1 Answer
What reason could there be, if a parent object refuses to take the new given position? 0 Answers
how do i keep an item destroyed when i change the scene c# 0 Answers