- Home /
Question by
waterdiver · Oct 31, 2018 at 07:30 PM ·
c#animationmovement
animation moving
have tried this script like 10 times but when I press the w key nothing happened then I noticed that it was moving the symbols at the top left where the hand tool is so w takes it to move q to the hand and e to the rotate and so on what am I missing everything is the same as the tutorial plz help or anyone else help if u know the problem ty
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class nightControl : MonoBehaviour {
float speed = 4;
float rotSpeed = 80;
float gravity = 8;
Vector3 movedir = Vector3.zero;
CharacterController controller;
Animator anim;
void stat()
{
controller = GetComponent<CharacterController>();
anim = GetComponent<Animator>();
}
void Update()
{
if (controller.isGrounded)
{
if (Input.GetKey (KeyCode.W))
{
movedir = new Vector3(0, 0, 1);
movedir *= speed;
}
}
movedir *= gravity * Time.deltaTime;
controller.Move(movedir * Time.deltaTime);
}
}
Reply
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612181319im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
Multiple Cars not working 1 Answer
Where should I attach my camera? 1 Answer