Bawię się od niedawna Unity tylko napotkałem problem związany z tym że funkcja transform.Rotate(float xAngle,float yAngle,float zAngle); obraca mimo że jeszcze nie nacisnę żadnego klawisza a więc wszystkie wartości powinny być zero.
```using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class fly2 : MonoBehaviour
{
public float force;
public float dex;
Rigidbody r;
float mx;
float my;
void Start()
{
r = GetComponent<Rigidbody>();
mx = 0f;
my = 0f;
}
// Update is called once per frame
void Update()
{
float actfx,actfy,actfz;
actfz = actfy = actfx = 0;
if (Input.GetKey(KeyCode.Space))
actfz = force * dex;
if(Input.GetKey(KeyCode.RightShift))
actfz = -force * dex;
mx = Input.GetAxis("Horizontal");// mam tu klawisze
my = Input.GetAxis("Vertical"); // tu mam klawisze
actfx = mx * force;
actfy = my * force;
actfz += (actfx * dex) + (actfy * dex);
r.AddForce(actfx, actfy, actfz);
float rmod = 1;
Debug.Log("wart obrot x= " + actfx);
Debug.Log("wart obrot y= " + actfy);
Debug.Log("wart obrot z= " + actfz);
transform.Rotate(actfx * rmod, actfy * rmod, actfz * rmod);// Tu jest linijka o ktora mi chodzi
}
void FixedUpdate()
{
}
}