How to solve the gimbal lock in .NET?
How to solve the gimbal lock in .NET?
Does Irrlicht happen to have any type of feature where you can do some free degrees of rotation as in pitch, yaw and rolling??
Or do we have to do some calculations itself?
I know how the C++ thing can be done but what about C#.NET?
Or do we have to do some calculations itself?
I know how the C++ thing can be done but what about C#.NET?
I am unsure how Irrlicht approaches rotations at the moment, I am guessing using matrices. I myself prefer quaternions because they all together avoid the gimbal lock. But, I am not quite sure what you are looking for here. Are you looking for a way to use Euler (yaw/pitch/roll) Angles and translate them to the native Irrlicht rotation methods?
I've tried this method in ittlicht using VB.NET instead:
'Yaw
X = zpos(i) * Sin(Yaw) + xpos(i) * Cos(Yaw)
Y = ypos(i)
z = zpos(i) * Cos(Yaw) - xpos(i) * Sin(Yaw)
'Pitch
X2 = X
y2 = Y * Cos(Pitch) - z * Sin(Pitch)
Z2 = Y * Sin(Pitch) + z * Cos(Pitch)
'Roll
x3 = y2 * Sin(Roll) + X2 * Cos(Roll)
Y3 = y2 * Cos(Roll) - X2 * Sin(Roll)
z3 = Z2
And the rotation didn't go well.
If someone can provide an example either in VB.NET or C#.NET, then I would be happy camper. I'm too lazy to do it right myself since it's late at night.
Though there seems to be a lack of examples provided with the .NET framework.
'Yaw
X = zpos(i) * Sin(Yaw) + xpos(i) * Cos(Yaw)
Y = ypos(i)
z = zpos(i) * Cos(Yaw) - xpos(i) * Sin(Yaw)
'Pitch
X2 = X
y2 = Y * Cos(Pitch) - z * Sin(Pitch)
Z2 = Y * Sin(Pitch) + z * Cos(Pitch)
'Roll
x3 = y2 * Sin(Roll) + X2 * Cos(Roll)
Y3 = y2 * Cos(Roll) - X2 * Sin(Roll)
z3 = Z2
And the rotation didn't go well.
If someone can provide an example either in VB.NET or C#.NET, then I would be happy camper. I'm too lazy to do it right myself since it's late at night.
Though there seems to be a lack of examples provided with the .NET framework.
I've tried this method in ittlicht using VB.NET instead:
'Yaw
X = zpos(i) * Sin(Yaw) + xpos(i) * Cos(Yaw)
Y = ypos(i)
z = zpos(i) * Cos(Yaw) - xpos(i) * Sin(Yaw)
'Pitch
X2 = X
y2 = Y * Cos(Pitch) - z * Sin(Pitch)
Z2 = Y * Sin(Pitch) + z * Cos(Pitch)
'Roll
x3 = y2 * Sin(Roll) + X2 * Cos(Roll)
Y3 = y2 * Cos(Roll) - X2 * Sin(Roll)
z3 = Z2
And the rotation didn't go well.
If someone can provide an example either in VB.NET or C#.NET, then I would be happy camper. I'm too lazy to do it right myself since it's late at night.
Though there seems to be a lack of examples provided with the .NET framework.
Edit: I noticed the previous code it used for making 3D drawings on a 2D screen.
'Yaw
X = zpos(i) * Sin(Yaw) + xpos(i) * Cos(Yaw)
Y = ypos(i)
z = zpos(i) * Cos(Yaw) - xpos(i) * Sin(Yaw)
'Pitch
X2 = X
y2 = Y * Cos(Pitch) - z * Sin(Pitch)
Z2 = Y * Sin(Pitch) + z * Cos(Pitch)
'Roll
x3 = y2 * Sin(Roll) + X2 * Cos(Roll)
Y3 = y2 * Cos(Roll) - X2 * Sin(Roll)
z3 = Z2
And the rotation didn't go well.
If someone can provide an example either in VB.NET or C#.NET, then I would be happy camper. I'm too lazy to do it right myself since it's late at night.
Though there seems to be a lack of examples provided with the .NET framework.
Edit: I noticed the previous code it used for making 3D drawings on a 2D screen.
-
- Posts: 22
- Joined: Fri Jun 03, 2005 2:00 pm
- Location: Argentina
Hi!
I don't still know a lot of develop in games 3D and Irrlicht, but I am making some tests with code that appears in this post:
http://irrlicht.sourceforge.net/phpBB2/ ... ra&start=0
There are some samples in c++ and an adaptation that made for C#. It is not complete, but with something of effort one can make run.
Some day the community. NET of Irrlicht will have thousands of examples to advance more quickly
I don't still know a lot of develop in games 3D and Irrlicht, but I am making some tests with code that appears in this post:
http://irrlicht.sourceforge.net/phpBB2/ ... ra&start=0
There are some samples in c++ and an adaptation that made for C#. It is not complete, but with something of effort one can make run.
Some day the community. NET of Irrlicht will have thousands of examples to advance more quickly
Sergio Cossa
Argentina
Argentina
I am having a hard time converting this to VB.NET.
I am taking one segment at a time and putting it in to the VB code.
In C#
TO VB.NET
So is there any where how I can convert where A *= B to VB.NET?
I suppose A=A*B?
Sorry I know a little about C#.
I am taking one segment at a time and putting it in to the VB code.
In C#
Code: Select all
//--- rotate node relative to its current rotation -used in turn,pitch,roll ---
public static void Rotate(Irrlicht.Scene.ISceneNode node, Irrlicht.Core.Vector3D rot) {
Irrlicht.Core.Matrix4 m = node.RelativeTransformation;
Irrlicht.Core.Matrix4 n = new Irrlicht.Core.Matrix4();
n.SetRotationDegrees(rot);
m *= n;
node.Rotation = getRotationDegrees( m );
}
Code: Select all
Public Sub Rotate(ByVal node As Irrlicht.Scene.ISceneNode, ByVal rot As Irrlicht.Core.Vector3D)
Dim m As Irrlicht.Core.Matrix4 = node.RelativeTransformation
Dim n As Irrlicht.Core.Matrix4 = New Irrlicht.Core.Matrix4
n.SetRotationDegrees(rot)
m *= n
node.Rotation = getRotationDegrees(m)
End Sub
I suppose A=A*B?
Sorry I know a little about C#.