Witam. Przerabiam tutorial z ytb na temat tworzenia gier. Ale po wpisaniu kody mój statek porusza się strasznie szybko, a ten z tutoriala spokojnie. Tutaj podaję kod jaki jest w filmiku:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShipController : MonoBehaviour
{
private Rigidbody2D rb;
public float maxVelocity = 0;
public float rotationSpeed = 0;
private void Start()
{
rb = GetComponent<Rigidbody2D>();
}
private void Update()
{
float yAxis = Input.GetAxis("Vertical");
float xAxis = Input.GetAxis("Horizontal");
ThrustForward(yAxis);
Rotate(transform, xAxis * rotationSpeed);
}
#region Maneuvering API
private void ClampVelocity()
{
float x = Mathf.Clamp(rb.velocity.x, -maxVelocity, maxVelocity);
float y = Mathf.Clamp(rb.velocity.y, -maxVelocity, maxVelocity);
rb.velocity = new Vector2(x, y);
}
private void ThrustForward(float amount)
{
Vector2 force = transform.up * amount;
rb.AddForce(force);
}
#endregion
private void Rotate(Transform t, float amount)
{
t.Rotate(0, 0, amount);
}
}
Proszę o pomoc, co zrobić by ten statek poruszał się wolniej i obracał wolniej bo obrót to jakaś masakra.