using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlaneController : MonoBehaviour
{
public float throttleIncrement = 0.1f;
public float maxThrust = 200f;
public float responsiveness = 10f;
private float throttle;
private float roll;
private float pitch;
private float yaw;
private float responseModifier{
get {
return (rb.mass / 10f) * responsiveness;
}
}
Rigidbody rb;
private void Awake()
{
rb = GetComponent<Rigidbody>();
}
private void handleInputs()
{
roll = Input.GetAxis("Roll");
Pitch = Input.GetAxis("Pitch");
yaw = Input.GetAxis("Yaw");
if (Input.Getkey(keyCode.Space)) throttle += throttleIncrement;
else if (Input.Getkey(keyCode.LeftControl)) throttle -= throttleIncrement;
throttel = Mathf.Clamp(throttle, 0f, 100f);
}
private void Update()
{
handleInputs();
}
private void Fixedupdate()
{
rb.Addforce(trasform.forward * maxThrust * throttle);
rb.AddTorque(trasform.up * yaw * responseModifier);
rb.AddTorque(trasform.right * pitch * responseModifier);
rb.AddTorque(trasform.forward * roll * responseModifier);
}
}
These are the errors
Assets\scripts\PlaneController.cs(37,19): error CS0117: ‘Input’ does not contain a definition for ‘Getkey’
Assets\scripts\PlaneController.cs(37,26): error CS0103: The name ‘keyCode’ does not exist in the current context
Assets\scripts\PlaneController.cs(38,24): error CS0117: ‘Input’ does not contain a definition for ‘Getkey’
Assets\scripts\PlaneController.cs(38,31): error CS0103: The name ‘keyCode’ does not exist in the current context
Assets\scripts\PlaneController.cs(39,9): error CS0103: The name ‘throttel’ does not exist in the current context
Assets\scripts\PlaneController.cs(54,21): error CS0103: The name ‘trasform’ does not exist in the current context
Assets\scripts\PlaneController.cs(54,12): error CS1061: ‘Rigidbody’ does not contain a definition for ‘Addforce’ and no accessible extension method ‘Addforce’ accepting a first argument of type ‘Rigidbody’ could be found (are you missing a using directive or an assembly reference?)
Assets\scripts\PlaneController.cs(55,22): error CS0103: The name ‘trasform’ does not exist in the current context
Assets\scripts\PlaneController.cs(56,22): error CS0103: The name ‘trasform’ does not exist in the current context
Assets\scripts\PlaneController.cs(57,22): error CS0103: The name ‘trasform’ does not exist in the current context