# Rotating point based on texture coordinates

This topic is 2854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

So I'm trying to rotate a point based on texture coordinates but I'm failing to do it correctly.

I want the point to rotate a full circle by the end of the texture coordinates.

Here's what I'm doing...

coords starts at (0,uv.y - 0.5, 0.5)

rotCoords.x = coords.x * cos(uv.x * 8) - coords.z * sin(uv.x * 8);
rotCoords.z = coords.x * sin(uv.x * 8) + coords.z * cos(uv.x * 8);

but the rotation isn't right... it's offset a little bit. I don't know what to multiply the uv.x by.

I got 8 just by trial and error. It seems the closest to what I want, but if someone could help me with the exact math I'd appreciate it, thanks.

##### Share on other sites
if uv.x is in the range [0-1) you need to get that into the range [-π,π) for sin/cos to make a full circle and be accurate.
so...
(uv.x * 2 * π - π)

π ~= 3.14159265358979323

##### Share on other sites
Thanks.

I think it's working now.

[Edited by - Butabee on September 30, 2010 8:46:56 PM]

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 10
• 14
• 30
• 13
• 11
• ### Forum Statistics

• Total Topics
631788
• Total Posts
3002356
×