Python Forum

Full Version: SinCos Vectors Math
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi every one!
i have question about math
I have oculus controllers witch give me position and rotation of them, also i have surface somewhere in the space(x,y,z) The problem is that when i point my controller on that surface i wanna got the coordinates of this point in this surface and apply it to some geometry.
I found some code but something wrong with this, its didnt gave me the right result:


xr = math.cos(yaw)*math.cos(pitch)
yr = math.sin(yaw)*math.cos(pitch)
zr = math.sin(pitch)
x1 = xc+(d-zc)/zr*xr
y1 = yc+(d-zc)/zr*yr
z1 = zc+(d-zc)/zr*zr
yaw,pitch roll: controller rotation
xc,yc,zc: controller coordinates in the space
x1,y1,z1: output coordinates that i need
thanks for any help