DYNAMIC
Tells wether an entity is dynamic, i.e. it can change its position or parameters at runtime, can trigger or execute events, and is affected by game_save / game_load. If this flag is not set, the entity is static, meaning that it doesn't change at runtime. Static entities consume less memory and CPU resources than dynamic entities.
Type:
flag (emask)
Remarks:
- Entities placed in a level are dynamic if an action is assigned; otherwise they are static. Therefore do not assign unnecessary actions to entities.
- Entities created by ent_create are always dynamic.
- Static entites won't run events, including material events. Their parameters, except for their skills, can't be changed. They are not updated to the clients in a multiplayer system and are not saved by game_save.
- If an entity does not change anymore, this flag can be reset on a single player system one frame after the last change for improving the frame rate.
- Static entities won't get environment light updates when their position changes. So when displacing a static entity, switch it's dynamic flag on for one frame in order for it's lighting to be updated to its new position.
-
The physx_open function automatically registers all static entities for physics on level loading, and sets their group parameter to 1. If this is not desired, a different function can be written, with different criteria for registering physics entities.
Example (lite-C):
action make_me_static()
{
// set up the entity
...
my.emask &= ~DYNAMIC; //lite-C
}
See also:
ent_create ► latest version online