- Home /
Question by
Bogdan26 · Aug 23, 2018 at 12:02 PM ·
bugcharactercontroller
I get launched when I walk off a surface with CharacterController
Here's the video: https://streamable.com/dhixx
and here's the PlayerMove script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMove : MonoBehaviour {
CharacterController charControl;
public float walkSpeed;
void Awake () {
charControl = GetComponent<CharacterController>();
}
void Update () {
MovePlayer();
}
void MovePlayer()
{
float horiz = Input.GetAxis("Horizontal");
float vert = Input.GetAxis("Vertical");
Vector3 moveDirSide = transform.right * horiz * walkSpeed;
Vector3 moveDirForward = transform.forward * vert * walkSpeed;
charControl.SimpleMove(moveDirSide);
charControl.SimpleMove(moveDirForward);
}
}
Comment