I'm using the new input system which I think is just awesome, however in my game I need the character to be able to climb a ledge and with the new input system, i have no idea how to implement that kind of script or action. I tried a google search for a simple climb script but when I implement it, a consol error comes up saying "Character Controller.Move called on inactive Controller?
here is the script I'm trying to use.
Transform chController;
bool inside = false;
float heightFactor = 3.2f;
private CharacterController FPSInput;
void Start()
{
FPSInput = GetComponent();
}
void OnTriggerEnter(Collider Col)
{
if (Col.gameObject.tag == "Ledge")
{
FPSInput.enabled = false;
inside = !inside;
}
}
void OnTriggerExit(Collider Col)
{
if (Col.gameObject.tag == "Ledge")
{
FPSInput.enabled = true;
inside = !inside;
}
}
void Update()
{
if (inside == true && Input.GetKey("Jump"))
{
chController.transform.position += Vector3.up / heightFactor;
}
}
its not a perfect script for what i want but its a start if i can just get it to work. I would much prefer to use the Invector Asset Package but I cant afford it so my only choice is to make the script from scratch or hopefully someone here can help me.
↧