Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize dynamic object creation in TE

Shulou Source: shulou.com Published: 2022-06-01 03:38:01 09月26日 Update

This article mainly shows you "how to achieve dynamic object creation in TE", the content is easy to understand, clear, hope to help you solve your doubts, let the editor lead you to study and learn "how to achieve dynamic object creation in TE" this article.

Generally, in the development of the system, TE uses CreateDynamicObject under Creator to create dynamic objects, which is encapsulated by sdk, but the adjustment in turning requires some skills.

TE sample, also provides another way of dynamic object creation, and there is an example of JavaScript script code, the idea of creating this dynamic object is to create a model, according to the change of time, dynamically change the location of the model, location change in onframe, the frequency of change is very high, and the effect is more consistent.

The sample JavaScript code is relatively simple, as shown below:

/ / create a default location

Var pos = _ sgworld.Creator.CreatePosition (- 122.38050, / / x

37.62331, / / y

40.0, / / height

3, / / height type

297.0, / / yaw

15.0, / / pitch

0, / / roll

0 / / dist

);

/ / create a model at the default location

Model = _ sgworld.Creator.CreateModel (pos, "D:\\ c5.xpc", 1)

Model.Attachment.AutoDetach = false

/ / fly to the model

_ sgworld.Navigate.FlyTo (model)

/ / implemented in onframe. For details of hooking up onframe, please see api documentation.

Function sOnFrame () {

/ / determine that the model object is not empty

If (model) {

/ / move the model position according to the distance and angle, in the example, move the model in a circle

Var distToMove = (1000 / 3600) * (new Date () .getTime ()-time.getTime ()) / 1000

Model.Position = model.Position.Move (distToMove, model.Position.Yaw + 0.1, model.Position.Pitch)

/ / Update time

Time = new Date ()

}

Effect picture:

These are all the contents of the article "how to create dynamic objects in TE". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Dynamics objects models location content articles changes code effects ways time learning help movement ideas techniques turns renderings documents aspects Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi OPPO Reno Microsoft vpn Docker