Expand description
đ World API
A world consists of entities, which each simply is a set of components such as transform, render properties, physical properties and so on. The World API lets you create, change manipulate and destroy entities.
For an overview, check out our Developer Guide
If youâre looking for immediate mode rendering instead of having persistent entities or physics managed
for you, youâre probably more interested in the Render API.
You can even combine the two. One possibility would be to do rendering of World API entities manually using the Render API
Render components, or simply to render transient visual effects using the Render API on top of a world.
The documentation of Entity is a good starting point to figure out what can be done.
Example
Quick example of setting up a ball on a square piece of ground:
let ground_mesh = ...;
let ground_entity = Entity::create("ground");
ground_entity.render().mesh().set(ground_mesh);
ground_entity.physics().enable_static(PhysicsShape::Box);
let ball_mesh = ...;
let ball_entity = Entity::create("ball");
ball_entity.render().mesh().set(ball_mesh);
ball_entity
.transform()
.position()
.set(Vec3::new(0.0, 2.5, -40.0));
ball_entity.physics().enable_dynamic(10.0, PhysicsShape::Sphere);
ball_entity.physics().add_force(
ForceType::Force,
ForceMode::Impulse,
Vec3::new(0.0, 0.0, 50000.0),
);Macros
Structs
AnimationBuilder is used to build an animation for a component value.AudioSource component.D6Joint component. A D6 joint, like a Joint, connects two dynamic, or one static and one dynamic, entity physically.
It doesnât have to be a component of one of the entities it connects, but that can be convenient at times.EntityArena is a collection for holding on to entities. Use it to keep track of sets of entities
A global arena exists in which entities can be created and clonedEntityMessageDispatcher is a hub for managing messages to / from the hostLookAt structmin_x/min_y/width/height are in World units, same as the size the text will appear in the world if you apply no scalingMeshStyle component.world::MeshStyle in that MeshStyle is an entity, but
MeshStyleData is plain data.MeshStyle through builder patternMeshStyle.SdfModel component or rendered using a Render component.Render component as a shape.SpatialQueryRequest contains all data needed to perform a spatial querySpatialQueryRequest using an ergonomic interface with sensible defaults.ValueAccessor is used to set/get/animate a component value.
bool and i64 types will be set to target directly when using animate.Value enum.WorldEntityQuery can be used to retrieve entities in the world
using various requirements.WorldEntityQueryBuilder to build a WorldEntityQuery with an ergonomic interface.WorldMaterialâs attached to the MeshStyle.Enums
world__create_data or by the host.Joint.Joint.Joint.add_force / add_force_at.add_force / add_force_at.Joint, changes how it will behave if it reaches the set limitsJoint.Physics component should use.world__retrieve_dataadd_force / add_force_at.