Untitled
unknown
plain_text
3 years ago
491 B
5
Indexable
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
private Rigidbody rb;
public float speed;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
speed = 10;
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.W))
{
rb.AddForce(Vector3.forward * speed);
}
}
}
Editor is loading...