Dont know how to change X and Z values without changing the Y.
I have some code that is supposed to make an entity jump around and turn on the Y axis while they are jumping
aiRb.velocity=new Vector3(Random.Range(minMoveXZ,maxMoveXZ),Random.Range(minMoveY,maxMoveY),Random.Range(minMoveXZ,maxMoveXZ));
aiRb.AddTorque(0,Random.Range(-maxRotation,maxRotation),0);
. But I had this problem where they would always fall over while they moved. So I put in this code.
transform.rotation=Quaternion.Euler(0.0f,transform.rotation.y,0);
But now the entities won't rotate on the Y axis at all. Also, I am new to Unity. Thank you in advance.
Comment