C# Camera Rotation Around its own Axis

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
ansu832001
Posts: 95
Joined: Thu Mar 01, 2007 6:39 am

C# Camera Rotation Around its own Axis

Post by ansu832001 »

Hi All,

Iam using Maya Camera and trying to move Camera around its own axis i.e camera should be able to see what is there around it.I know Maya camera doesn't provide help for this and that we have to write code to achieve it,but iam unable to do it.I Searched through forums but could not find precise solution.I already achieved walkthrough of Camera but unable to get past this problem. Help Needed.

Best Regards.
ansu832001
Posts: 95
Joined: Thu Mar 01, 2007 6:39 am

Problem Not solved yet,Code Provided

Post by ansu832001 »

Hi All,Iam using the below Code to rotate Camera on MouseMove().


public void CameraRotate()
{

float TimeElapsed=0.0f;

//Initial Values of below variables
//sngAngleY = 1.300002f;
//sngAngleX = -0.12f;
//sngStrafe = 1.0f;
//sngWalk = 1.0f;

// Simple check of the mouse.
if (sngAngleX > 1.3f)
{
sngAngleX = 1.3f;
}

if (sngAngleX < -1.3)
{
sngAngleX = -1.3f;
}

Vector3D position = cam.Position;
Vector3D target = cam.Target;
// Update the vectors using the angles and positions.
position.X = position.X + (float)(System.Math.Cos((double)sngAngleY) * sngWalk / 5.0f * TimeElapsed) + (float)(System.Math.Cos((double)sngAngleY + 3.141596 / 2) * sngStrafe / 5.0f * TimeElapsed);
position.Z = position.Z + (float)(System.Math.Sin((double)sngAngleY) * sngWalk / 5.0f * TimeElapsed) + (float)(System.Math.Sin((double)sngAngleY + 3.141596 / 2) * sngStrafe / 5.0f * TimeElapsed);

// We update the look at position.
target.X = position.X + (float)System.Math.Cos((double)sngAngleY);
target.Y = position.Y + (float)System.Math.Tan((double)sngAngleX);
target.Z = position.Z + (float)System.Math.Sin((double)sngAngleY);

cam.Position = position;
cam.Target = target;
}

Please Help me with the Problem.

Best Regards.
ansu832001
Posts: 95
Joined: Thu Mar 01, 2007 6:39 am

Solved

Post by ansu832001 »

Thanks All
Locked