partial stuck in the terrain
It appears the issue is with the Character Controller. Have Mesh Colliders on everything but the Soldier. Where the Tutorial video he placed the soldier as child of the game object player. When he added Character controller on the Player, not the solider, the lines of the character controller covered the soldier. When I followed suit, it was to the side of the soldier. Now not falling all the way through the road but the soldier only runs in place with the arrow keys but not move.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerMovement : MonoBehaviour { //Declaring variables private CharacterController characterController; private Animator animator; [SerializeField] private float moveSpeed = 100f; [SerializeField] private float turnSpeed = 5f;
// Start is called before the first frame update
private void Awake()
{
characterController = GetComponent<CharacterController>();
animator = GetComponentInChildren<Animator>();
}
// Update is called once per frame
private void Update()
{
var horizontal = Input.GetAxis("Horizontal");
var vertical = Input.GetAxis("Vertical");
var movement = new Vector3(horizontal, 0, vertical);
characterController.SimpleMove(movement * Time.deltaTime * moveSpeed);
animator.SetFloat("Speed", movement.magnitude);
if (movement.magnitude > 0)
{
Quaternion newDirection = Quaternion.LookRotation(movement);
transform.rotation = Quaternion.Slerp(transform.rotation, newDirection, Time.deltaTime * turnSpeed);
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613045941im_/https://answers.unity.com/themes/thub/images/avi.jpg)