#### Archived

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

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

## 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 on other sites
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 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

• ### Forum Statistics

• Total Topics
628320
• Total Posts
2982072

• 21
• 9
• 9
• 13
• 11