Jump to content
• Advertisement

#### Archived

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

# Sin and Cos are not precise for a 3D game...!

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

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I have an array for all my vertices... When i rotate i simply overwrites the cordinates of all vertices with the result of the rotation formula (i guess you know that). It works fine exept for one thing... If i constantly rotate, all the points seems to go closer to the camera...I would guess that Sin and Cos are not precise enough for this... Then i was thinking of have an array that i only reads from and then doing all the calculations by having the camera position and stuff... But how would i do this?

#### Share this post

##### Share on other sites
Advertisement
That effect is probably a cumulative error.
You probably grab a batch of vertices from
your Vertex Array (VA) and apply a matrix transformation
to them, and then store those values back into the VA, right?

If this is what you''re doing, then a very small error
gets propagated in each frame. The more frames pass by,
the more obvious the error becomes.

What you have to do is setup a VA that will never change,
and Target vertex array, where you''ll store the transformed
vertex data:
VA->Matrix Transformation->TVA->OpenGL->...

get it?

[Hugo Ferreira][Positronic Dreams]
Need [3D Artist] & [Sound Designer]
for small project. Contact me plz...

#### Share this post

##### Share on other sites
just a few hints.

1) Floating point calculations are not 100% accurate as well (accumulative errors).

2) Don''t over-write the origional coordinates.

struct tVertex{   ...   tVector position;  // origional position   tVector world;     // current position   ...}

Apply the transformation matrix using the position vector and store it in world.

........ outta here
xsist10

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Now

• 10
• 19
• 14
• 19
• 15
• Advertisement
• Advertisement
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!