#How does Rotation work with an object?

1 messages · Page 1 of 1 (latest)

analog raptor
#

I have a spawner that spawns a specific object (LaserPrefab). I'm trying to figure out how to use the rotation property to insert my own values. I am not sure how Quaternions really work and what the Quaternion.w actually means.

I have this line written:

Instantiate(LaserPrefab, new Vector3(transform.position.x, Random.Range(LowerBoundary,UpperBoundary), 0), transform.rotation);```

What I want do is to replace `transform.rotation` with my own values of `0`, `0`,`Random.Range(0,359)`. How do I do this?
#

Also this is a 2d game

solar delta
#

What I want do is to replace transform.rotation with my own values of 0, 0,Random.Range(0,359). How do I do this?
If you want to create a quaternion out of a set of Euler angles you can use Quaternion.Euler(x, y, z)

analog raptor
solar delta
#

Use Quaternion.Euler

#

not new

analog raptor
#

Okay thanks, I'll try that.