#### Archived

This topic is now archived and is closed to further replies.

# Angle -> Vector

## Recommended Posts

How do you convert from an X/Y angle pair into a directional vector that could be accepted by a spot D3DLIGHT?

##### Share on other sites
Normalize with some D3DX function. Can''t remember the exact functionname. =)

.lick

##### Share on other sites
Could you please be more specific? I really have no idea...

##### Share on other sites
If you''re talking a Theta/Phi pair, you can plug them into the parametric form of a sphere and get a normalized vector in return. Ask if you need more help.

##### Share on other sites
Well I know what you're talking about but I don't know how to implement it/what to do. Could you explain?

Edit: Corrected some grammar

[edited by - Karl G on September 1, 2003 6:01:21 PM]

##### Share on other sites
x = sin(theta)*cos(phi)
y = sin(theta)*sin(phi)
z = cos(theta)

Where theta is rotation about Z (in the interval -pi to pi) and phi is rotation about X (in the interval 0 to 2pi).

This should result in a unit vector pointing in the desired direction.

Later,
ZE.

##### Share on other sites
Awesome! Thank you very much this is just what I needed

• ### Forum Statistics

• Total Topics
628383
• Total Posts
2982372

• 10
• 9
• 15
• 24
• 11