using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class liikkuu : MonoBehaviour
{
Rigidbody m_Rigidbody;
float m_Speed;
void Start()
{
//Fetch the Rigidbody component you attach from your GameObject
m_Rigidbody = GetComponent<Rigidbody>();
//Set the speed of the GameObject
m_Speed = 30.0f;
}
void Update()
{
if (Input.GetKey(KeyCode.W))
{
//Move the Rigidbody forwards constantly at speed you define (the blue arrow axis in Scene view)
m_Rigidbody.velocity = transform.forward * m_Speed;
}
if (Input.GetKey(KeyCode.D))
{
transform.Rotate(0, 1f, 0);
}
if (Input.GetKey(KeyCode.A))
{
transform.Rotate(0, -1f, 0);
}
}
}