Question by
Brockmann_ · Nov 24, 2020 at 05:53 PM ·
c#charactercontroller
My CharacterController isnt moving
First of all, I know my script is incomplete, but it shoud still move at this point. I made a small script, attached it to my player GameObject and assigned my CharacterController to the public Variable defined in the Script. here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour {
public CharacterController controller;
public float speed = 12f;
void Update() {
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
Vector3 move = transform.right * x + transform.forward * z;
controller.Move(move * speed * Time.deltaTime);
}
}
I'm relatively new to Unity so I guess my problem is quite simple to solve, but I don't see it. Any help is appreciated thank you!
problem.png
(283.1 kB)
Comment
Your answer
Follow this Question
Related Questions
How to double my character's movement speed whenever spacebar is pressed? 0 Answers
Character flies up and gets stuck there, won't move forward? 1 Answer
Normalized Vector3 Movement Really Slow? 2 Answers
Character Rotation 0 Answers
How to double my character's movement speed whenever spacebar is pressed? 0 Answers