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
Macro for implementing standard accessor trait
Macro for implementing standard accessor trait, but with an index parameter.
Macro for implementing standard component trait
Structs
Represents an ongoing animation
An AnimationBuilder
is used to build an animation for a component value.
Struct describing an animation request.
Represents an audio clip
Struct for providing information about an audio clip.
AudioSource
component.
Represents raw binary data
Describes the transform of a bone. More compact and more defined than a Mat4.
Bounds component.
Camera component accessor.
A collision matrix, specifying what can collide with what.
Struct describing a specific component.
Struct describing all components
Represents a set of physics shapes
The parameters for a drive on a D6 joint.
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.
The parameters for a simple spring.
Represents a data object.
An Entity is a single âthingâ in the gameworld.
An 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 cloned
Entity info component. Use to get information about the entity such as name assigned.
Represents an entity layer filter that can be used with entity queries or raycasts.
The EntityMessageDispatcher
is a hub for managing messages to / from the host
Queue for entity messages
Utility for submitting message queues and collecting message responses.
An Entity is a single âthingâ in the gameworld.
The state of a requested entity value
Environment component accessor.
Represents formatted text that can be attached to a Render component.
Joint component. 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.
Layer component.
The limits for a parameter.
LookAt
struct
min_x
/min_y
/width
/height
are in World units, same as the size the text will appear in the world if you apply no scaling
Mesh properties
MeshStyle
component.
Mesh style. Differs from world::MeshStyle
in that MeshStyle
is an entity, but
MeshStyleData
is plain data.
Create MeshStyle
through builder pattern
Represents morph target weights attached to the MeshStyle
.
Struct describing a specific parameter of a component.
Physics component.
Physics character component
Represents a set of player ids used for filtering visual and audible things.
A position and orientation, together.
A single hit from a raycast query.
Query parameters for doing raycasts.
Render component.
Represents raw data that can be attached to a Render component to be rendered by a client-side render module.
SDF component.
Represents an SDF program you can attach to an SdfModel
component or rendered using a Render
component.
Represents an SDF skin you can set on a Render
component as a shape.
Represents an ongoing spatial query.
What we return from a query
A SpatialQueryRequest
contains all data needed to perform a spatial query
Use to build a SpatialQueryRequest
using an ergonomic interface with sensible defaults.
Tag component.
Transform component.
Transform3 struct.
Value accessor with read-write-access to data objects.
Value accessor with read-only access
Value accessor with read-write-access
A ValueAccessor
is used to set/get/animate a component value.
bool
and i64
types will be set to target directly when using animate
.
A utility to convert values to and from the Value
enum.
Velocity component.
World implements the low-level entity API and the mesh API.
Helper struct that represents a data object.
A WorldEntityQuery
can be used to retrieve entities in the world
using various requirements.
Use a WorldEntityQueryBuilder
to build a WorldEntityQuery
with an ergonomic interface.
Represents a material registered with the world.
Represents a vector of WorldMaterial
âs attached to the MeshStyle
.
Represents a reference to a mesh registered with the world.
Helper struct to get reflection data from the host.
Enums
Represents an audio clip resource
Not yet working.
Type used to describe a data object created using either world__create_data
or by the host.
The motion type of an axis of a D6 Joint
.
The drive types of a D6 Joint
.
The motion type of an axis of a D6 Joint
.
Represents an entity query type that can be used with entity queries to specify what the query should include before filtering.
Used with add_force
/ add_force_at
.
Used with add_force
/ add_force_at
.
The limit type of a Joint
, changes how it will behave if it reaches the set limits
The type of a Joint
.
Represents the state of a message response.
Parameter type
Describes what a component parameter is or what it is used for.
Used to describe what physics shape the Physics
component should use.
Represents data for setting up a physics shape
Type describing what data to retrieve with world__retrieve_data
The rigid body mode of a Physics component of an entity.
Used with add_force
/ add_force_at
.
Represents a spatial query type for a spatial query request
Traits
Common interface that components expose.
Trait for animating component values
Trait for reading component values
Trait for writing component values
Common trait for value converters.
Functions
Sends multiple messages
Type Definitions
The type of a callback function to receive collision events.
Represents the unique multiplayer id of a player.
A raw handle to a unique resource
The type of a callback function to receive the result of a spatial query
The type of a callback function to receive trigger events.