c# - OpenGL-OpenTK rotation problems -


I'm a real Noah who has just started learning 3D programming and I have about rotation in the 3D space It is a very difficult time to learn. My problem is that I do not seem to understand how to use the local coordinates of the object.

I have a basic class for 3D objects, and for starters, I want to apply the function which will rotate the object on a certain axis with X degree so far I have the following: / P>

  public zero rolled (float angle) {this. Rotation = Matrix 4 Malt (Rotation, Matrix 4. Crearatotation X (MyMath Conversion) Digotrade (Angle)); } Public Zero Pichadag (float angle) {this.rotation = Matrix4.Mult (rotation, Matrix4.CreateRotationY (MyMath.Conversions.DegToRad (angle))); } Public Zero Yawdag (float angle) {This. Rotation = Matrix 4 Malt (rotation, matrix 4. creole rotation (MyMath.Conversions.DegToRad (angle))); }  

'rotation' is a 4x4 matrix that starts in the form of identity matrix. Every time I want to roll / pitch / highlight the object, I call one of the above tasks.

For drawing, I use another function that puts a matrix on the modelview stack, multiply it with translation, rotation of the object and scale matrix (in this order) and shorts The drawing begins. Of course, I stop the matrix from the stack.

The problem is that the above functions do not move locally to the objects on the global axis, even if I think every time you rotate an object, there is a change in the axis in the local system. And then, when a new rotation is applied to the top of others, then the local axis is used for a new one.

I read various tutorials about mathematics and how to rotate the objects, but no one was able to help me.

If anyone has time, I really appreciate it if he wants me to roam around the local axis and, perhaps more importantly, what I did wrong in my present implementation.

If you want to make your changes in this order: Translation -> Rotation -> Scale (Joe It really makes sense, what it's usually to do), you have to multiply your metric into a reverse order.

In the right-hand coordination, the food system (i.e. uses an open GL), the matrix should be multiplied on the right side. This is the reason:

ModelViewTransform = Transform * View * Model // & lt; - You start with the model, right? So it is in this way

Note that they use a left-handed coordination system in DirectX. It has its drawbacks, but it is more intuitive.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -