实体相关属性
Each time you add a new model representing an entity to the world you should assign all necessary properties and adjust their parameters to ensure proper integration into the simulation environment.每次您添加代表实体对于世界,您应该分配所有必要的属性并调整其参数,以确保正确集成到仿真环境中。
Before you start configuring properties, check that all pivot axes for the model are set properly:在开始配置属性之前,请检查是否正确设置了模型的所有枢轴:
- The main pivot for the aircraft model should be set close to its center, with X axis pointing to the right and Y axis pointing forward.飞机模型的主枢轴应设置在其中心附近,其中X轴指向右侧,而Y轴指向前方。
- Horizontal parts should have their pivot axes oriented along the +X (left-to-right relative to the plane), while vertical ones — along the +Z (bottom-to-top). Initial rotation angles of parts do not matter, important is that they should be in neutral position: extended — for gears, and retracted — for flaps.水平零件的枢轴应沿+X(相对于平面从左到右)定向,而垂直零件的枢轴应沿+Z(从下至上)定向。零件的初始旋转角度无关紧要,重要的是它们应处于中间位置:伸出(用于齿轮)和缩回(用于风门)。
Model Simplification模型简化#
The Simplifier component can help optimize rendering of your entities. This component, when assigned to an entity, enables you to define which parts of its model can be neglected starting at certain distance levels (e.g., hide flaps, ailerons, and rudders at 1km, engines at 5 km, etc.) and which substitutes can be used to represent an entity at a large distance (e.g., a flashing strobe light, when the plane is just a point on the screen).Simplifier组件可以帮助优化实体的呈现。通过将此组件分配给实体,您可以定义从某个距离级别开始可以忽略其模型的哪些部分(例如,在1 km处的皮革襟翼,副翼和方向舵,在5 km处的引擎等)以及可以替代的部分可以用于表示远距离的实体(例如,当平面只是屏幕上的一个点时,频闪灯闪烁)。
Basically there are 3 layers of LODs:基本上有3层LOD:
- Surfaces Layer — UNIGINE's standard LOD SystemSurfaces Layer — UNIGINE的标准LOD系统
- Simplifier Nodes — when nodes change their enabled flag and detached from parentSimplifier Nodes —当节点更改其enabled标志并与父节点分离时
- Billboard Nodes — whole nodes become disabled (hidden) and only substituting billboards are shownBillboard Nodes —禁用(隐藏)整个节点,仅显示替换广告牌
To configure model simplification, assign a property inherited from the Simplifier to the node, and indicate which nodes are to be hidden at which distance, and when to substitute your model with an impostor:要配置模型简化,请将从Simplifier继承的属性分配给该节点,并指示要在哪个距离隐藏哪些节点,以及何时用冒名顶替者替代模型:
Surface LODs can be combined with Simplifier LODs:曲面LOD可以与Simplifier LOD结合使用:
- At a distance of 1000 and closer, flaps are represented by separate meshes.在1000或更近的距离处,襟翼由单独的网格表示。
- If the plane is at a distance of 1000+, we can hide all flaps and enable a surface LOD for wings with flaps.如果飞机的距离为1000+,我们可以隐藏所有襟翼并为具有襟翼的机翼启用表面LOD。
The last Billboard node replaces all model's geometry at a certain distance.最后的Billboard节点将在一定距离处替换所有模型的几何图形。
The Simplifier component has its own distance scale value which enables quick tuning of the simplification process while balancing between quality and performance.Simplifier组件具有其自己的distance scale值,该值可以快速调整简化过程,同时在质量和性能之间取得平衡。
Prespawned Entities预先产生的实体#
You can create entities not only from code, but via UnigineEditor as well. This is achieved by assigning the EntityComponent property to an object. The entity in this case will already exist in the world, and all settings attributable to its type will be uploaded on the world load.您不仅可以从代码中创建实体,还可以通过UnigineEditor创建实体。这是通过将EntityComponent属性分配给对象来实现的。在这种情况下,实体将已经存在于世界中,并且归因于其类型的所有设置都将在世界负载中上载。
Wheels轮圈#
The Wheel property is intended for wheels or groups of wheels to fine-tune their behavior to make them look more natural:Wheel属性用于车轮或车轮组以微调其行为,使它们看起来更自然:
- Always on Ground — is used for optimization: if the vehicle is not intended to fly, it doesn't require any ground contact checks, therefore some effort can be saved.Always on Ground —用于优化:如果车辆不打算飞行,则不需要进行任何地面接触检查,因此可以节省一些精力。
- Take-off Speed Damping — gradual slowing down of the wheel rotation after take-off to avoid its abrupt stop that looks unnatural.Take-off Speed Damping —起飞后逐渐放慢车轮旋转,以避免其突然停止看起来不自然。
- Contact Point Offset — the value (in meters) that allows fine-tuning the ground contact point for the wheel.Contact Point Offset —允许微调车轮接地点的值(以米为单位)。
- Wheel Steering — enables automatic steering of the wheel at the vehicle turning without any additional coding. You can also make the wheel rotate to the opposite direction by using the Invert Steering parameter and set the required Max Steering Angle.Wheel Steering —在车辆转弯时自动方向盘转向而无需任何其他编码。您还可以使用Invert Steering参数使砂轮向相反的方向旋转,并设置所需的Max Steering Angle。
- Emitter Node — a node that emits particles to create a certain effect such as dust, mud, or splashes generated by the wheels.Emitter Node —一个节点,该节点发出粒子以产生某种效果,例如轮毂产生的灰尘,泥土或飞溅。
The ground contact check is fine-tuned via the WheelControl property that allows setting the update period for this check in times per second:地面接触检查通过WheelControl属性进行了微调,该属性允许设置每秒更新此检查的时间:
Aircraft Lights飞机灯#
This section contains actions to be performed for controlled aircraft lights (landing, taxi, beacon, navigation, etc.).本节包含对受控飞机灯(着陆,滑行,信标,导航等)要执行的操作。
- Assign the LightAircraftController property to the parent node (aircraft) and leave all parameters unchanged.将LightAircraftController属性分配给父节点(飞机),并保持所有参数不变。
-
Assign the LightAircraft property to each node representing aircraft lights of various types.将LightAircraft属性分配给表示各种类型的飞机灯的每个节点。
- Set up the light parameters.设置灯光参数。
Aircraft Lights Control飞机灯控制#
Aircraft lights are controlled automatically by the IG. In case you implement some custom IG logic, you can control lights of an aircraft via code as follows:飞机灯由IG自动控制。如果实现某些自定义IG逻辑,则可以通过以下代码控制飞机的灯光:
Aircraft lights control example:飞机灯控制示例:
// getting an aircraft entity by its ID (see data/ig_config.xml)
Entity *entity = ig_manager->getEntity(__entity_id__);
// getting a property for the component by its ID (see data/ig_config.xml)
PropertyPtr p_light_outer = entity->getComponent(__component_id_from_config__)->getProperty();
// enable all lights (landing, taxi, etc.) for the aircraft
p_light_outer->getParameterPtr("landing")->setValueToggle(1);
p_light_outer->getParameterPtr("taxi")->setValueToggle(1);
p_light_outer->getParameterPtr("navigation")->setValueToggle(1);
p_light_outer->getParameterPtr("beacon")->setValueToggle(1);
p_light_outer->getParameterPtr("strobe")->setValueToggle(1);
p_light_outer->getParameterPtr("logo")->setValueToggle(1);
Lights灯#
Lights available in the scene and not referring to any aircraft can also be controlled.也可以控制场景中可用的且不指向任何飞机的灯光。
It is possible to control lights manually by assigning LightSourceComponent to them or automatically depending on time of day — in this case AutomaticTimeLightingComponent should be used.可以通过为灯光分配LightSourceComponent来手动控制灯光,也可以根据一天中的时间自动控制灯光-在这种情况下,应使用AutomaticTimeLightingComponent。
Interaction with Water与水的相互作用#
For objects and entities that are able to float on water, the WaterClamp property is available.对于能够在水上漂浮的对象和实体,可以使用WaterClamp属性。
The following parameters are available:可以使用以下参数:
- Clamp Enable — enabling the option identifies that the entity has the possibility to interact with the water surface (float on it), which is implemented according to IG commands. The Forced value makes the entity always be clamped to the water surface, which is suitable for boats, for example.Clamp Enable —启用该选项可标识实体有可能与水表面(浮在水上)交互,这是根据IG命令实现的。 Forced值使实体始终固定在水面,例如,它适用于船。
- Point Front Center — front waterline point.Point Front Center —前水线点。
- Point Back Left — rear left waterline point.Point Back Left —左后水线点。
- Point Back Right — rear right waterline point.Point Back Right —右后水线点。
- Intertia — relative weight value: the more the value, the heavier the object seems.Intertia —相对重量值:该值越大,物体看起来越重。
The following adjustments should be done to make water clamping work properly:为了使锁水工作正常,应进行以下调整:
- Intersection Mask of the Global Water object should be enabled and correlate with the IG terrain_intersection_mask.Intersection Global Water对象的掩码应启用,并与IG terrain_intersection_mask相关。
-
The entity should have the Ground Clamp attribute set to one of the following values:实体应将Ground Clamp属性设置为以下值之一:
- NON_CONFORMAL — the entity takes into account only the water height.NON_CONFORMAL-实体仅考虑水位。
- CONFORMAL — the entity takes into account both the height and the normals of the water surface.CONFORMAL-实体同时考虑了水面的高度和法线。
Collision Volumes碰撞体积#
A collision detection volume is required for intersection and collision detection. When a collision detection volume passes through another collision detection volume, the IG registers a collision by sending a Collision Detection Volume Definition packet to the Host identifying the collided volumes.碰撞检测体积是交叉口和碰撞检测所必需的。当碰撞检测体积通过另一个碰撞检测体积时,IG通过向主机发送一个标识碰撞体积的 Collision Detection Volume Definition 包来注册一个碰撞。
In CIGI, the Collision Detection Volume Definition is a sphere or a cuboid through which collision testing is performed by the IG.在CIGI中, Collision Detection Volume Definition 是一个球体或长方体,IG通过它进行碰撞测试。
Via UNIGINE Editor various collision volumes (sphere, box, capsule, cylinder, convex hull) may be used thus allowing a better approximation.通过UNIGINE编辑器,可以使用各种碰撞体积(球体,盒子,胶囊,圆柱体,凸包),从而允许更好的近似。
To use this option, create ObjectDummy and BodyDummy inside the entity NodeReference and add the corresponding entry in ig_config.要使用这个选项,在实体NodeReference中创建ObjectDummy和BodyDummy,并在ig_config中添加相应的条目。
Then enable collision for the volume either via code (Entity::setCollision) or using CIGIEntityControlPacket (set the collision flag to 1 on the host to enable intersection detection with this entity).然后通过代码(Entity::setCollision)或使用 CIGIEntityControlPacket(为主机上的碰撞标志设置值1以启用与该实体的交集检测)为体积启用碰撞。
Synchronization同步化#
When running IG with Syncker, it is required to synchronize entities to have their movements displayed both on the master and slave computers. This can be done either via code (Master::addSyncNode()), or using the property: in the Editor, assign the AddSyncNode property to the nodes that should be synchronized.当使用Syncker运行IG时,需要同步实体以使其活动显示在主计算机和从计算机上。这可以通过代码(Master::addSyncNode())或使用属性来完成:在编辑器中,将AddSyncNode属性分配给应同步的节点。