I’m trying to make my bean guy moving but he’s not. I’m unsure if I did something wrong in the script or did something wrong in Unity. Also this is my first time using the forums so sorry for the formatting…
Using:
C# Coding
Character Controller
Context:
3rd Person Movement
Keeping each part of code sperate (e.g. Camera and Movement are in separate scripts)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
public CharacterController controller;
// Movement Modifiers
private float speed;
public float speedWalk = 5f;
public float speedRun = 10f;
Vector3 velocity;
void Update()
{
// Movement Code
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;
// Walk and Run Statements
if (Input.GetKey(KeyCode.LeftShift))
{
speed = speedWalk;
}
else
{
speed = speedRun;
}
}
}