How to create camera Vision in TE Development
Xiaobian to share with you how to create a camera vision in TE development, I believe most people still do not know how, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
In a three-dimensional system, information from the camera is sometimes hooked up to simulate the field of view of the real camera, simulate the movement of the camera up and down in three dimensions, and simulate zooming in the field of view of the camera.
Here is the C#code implementation:
//mouse click to get position, set height to relative
IWorldPointInfo6 Iworldinfo = sgworld.Window.PixelToWorld(X, Y, WorldPointType.WPT_DEFAULT);
Iworldinfo.Position.AltitudeType = AltitudeTypeCode.ATC_TERRAIN_RELATIVE;
Iworldinfo.Position.Altitude = 10;
//Create a model of the camera
ITmodel = sgworld.Creator.CreateModel(Iworldinfo.Position, Model file path, 1, ModelTypeCode.MT_NORMAL, 0, "shipin");
//Set the camera's upward viewing angle
Iworldinfo.Position.Pitch = -90;
rtapos = Iworldinfo.Position.Copy();
//Create color
IColor6 crtcolor = sgworld.Creator.CreateColor(Color.LightBlue.R, Color.LightBlue.G, Color.LightBlue.B, 120);
//Create a cone effect
ITeRegBase = sgworld.Creator.CreateCone(Iworldinfo.Position, 2, 5, crtcolor, crtcolor, -1, 0, "shizhui");
//bind the cone to the model and fly it to the model
ITeRegBase.Attachment.AttachTo(ITemodel.ID, 0, 5, 0);
sgworld.Navigate.FlyTo(ITemodel);
//Left shift of camera and vertebral body
ITemodel.Position.Yaw += 10;
ITeRegBase.Position.Pitch = rtapos.Pitch;
ITeRegBase.Position.Yaw += 10;
//camera and vertebral contraction
ITeRegBase.Height += 1;
ITeRegBase.Attachment.AttachTo(ITemodel.ID, 0, ITeRegBase.Height,
0);
ITeRegBase.Position.Pitch = rtapos.Pitch;
ITeRegBase.Radius -= 0.3;
//Top view of camera and vertebral body
if (rtapos.Pitch > -130.0 && rtapos.Pitch < -35.0)
{
rtapos.Pitch -= 9;
ITeRegBase.Position.Pitch = rtapos.Pitch;
ITeRegBase.Attachment.AttachTo(ITemodel.ID, 0,
ITeRegBase.Height, 0);
ITemodel.Position.Pitch -= 9;
}
Camera effect:
The above is all the content of this article "How to create camera vision in TE development", thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!