- Home /
This question was
closed May 14, 2016 at 07:56 AM by
meat5000 for the following reason:
Search internet for CS codes.
Question by
zak666 · May 14, 2016 at 02:55 AM ·
randomdirectionscript errorturning
trying to turn in random direction : error CS0019: Operator `*' cannot be applied to operands of type `UnityEngine.Quaternion' and `float'
Hi guys, trying to make my spaceship turn slowly to direction rather then just "Jumping" to a new random direction, is their a way to sleep this? i have a timer that counts down and overtime it hits 0 it chooses another random direction to make the ship fly around "randomly"
Hi guysuim trying to turn my AI ship:
public Quaternion direction;
private float turnspeed = 12;
private float DirectionCooldown = 25f;
//---------------------------------------------------------------------------------------------------------------
void Start (){
direction = transform.rotation = Random.rotation;
}
// patrolling behavior
if (Patroling = true) {
if (PhotonNetwork.isMasterClient) {
this.transform.rotation = direction * turnspeed * Time.deltaTime;
// Invoke a loop:
DirectionCooldown -= 1 * Time.deltaTime;
if (DirectionCooldown < 1) {
//change directrion
direction = transform.rotation = Random.rotation;
DirectionCooldown = 25;
}
}
}
Comment