Cameras
Please consider the following code:
Code Snippet
CameraView view =newCameraView();
view.EyePosition =newVector3(0, 50, 0);
view.LookAtPoint =newVector3(0, 0, 0);
SimulationEngine.GlobalInstancePort.Update(view);
I am creating MainCamera.
If i repeat this code to create another camera, it replaces the MainCamera. What object I use to create another camera?
I also need a code to change the rotation of MainCamera, I can change it in Pose in Simulation Editor, but I can't do this in code.
Thanks a lot for your help.
[968 byte] By [
T.N.T.] at [2008-1-5]
In the code snippet above, you are not really creating a main camera, you are just setting the view of the main camera. Simulation Tutorial 2 shows you how to create another camera in the scene:
Code Snippet
CameraEntity cam1 = newCameraEntity(640, 480);
cam1.State.Name = "newcam1";
cam1.Location = newVector3(0, 1f, 0);
cam1.LookAt = newVector3(0, 1f, -1f);
cam1.IsRealTimeCamera = false;
SimulationEngine.GlobalInstancePort.Insert(cam1);
( this version uses the Location and LookAt members to set the camera orientation).
-Kyle
Ok, it works for me.
Except where are Vector3 I need to dim as Microsoft.Xna.Framework.Vector3.
I don't understand why Microsoft.Xna.Framework.Vector3 and Microsoft.Robotics.PhysicalModel.Vector3 aren't the same.
Thanks a lot KyleJ - MSFT for support us. I am becoming crazy with MSRS!
xna.Vector3 is a type defined by the XNA library. PhysicalModel.Vector3 is a type defined by our physics model. Unfortunately, some APIs take the physics model type and some take the XNA type. If you use xna vectors, you will have to add Microsoft.Xna.Framework.dll as a reference. You can find it in \windows\assembly\GAC_32\Microsoft.xna.framework.
-Kyle