logo
pub struct EntityOwned { /* private fields */ }
Expand description

An Entity is a single “thing” in the gameworld.

It can have multiple components attached, giving it a position in the world, a mesh to display, physical properties, and so forth.

The Entity struct has accessors to access its components, like transform, mesh_style, physics and so on.

This type will own its entity and destroy it when drop is called (i.e. when it goes out of scope).

Implementations

Lets you check whether this entity still exists and is valid.

Creates an empty world entity with just a name.

Add components of your preference to it.

Creates a world entity with Transform, Render, Physics, and MeshStyle components.

name - only used for display in the inspector and similar, it cannot later be changed or queried to affect the game so don’t store data in it.

Creates a world entity with Transform, Render and MeshStyle components.

name - only used for display in the inspector and similar, it cannot later be changed or queried to affect the game so don’t store data in it.

Creates a world entity with a Camera and Transform component.

An entity with a Camera component is special in that the rotation of its transform component will be controlled directly by the client. See the documentation of Camera for more details.

Clones this world entity and all its components.

name - only used for display in the inspector and similar, it cannot later be changed or queried to affect the game so don’t store data in it. Will be concatenated to the name of the source of the clone.

Adds a component to an entity.

Adds a component to an entity.

Copies a component from the entity in src.

Copies a component from the entity in src.

Returns whether the entity has the component or not.

Gets an interface to the component.

Returns an option, none if the component doesn’t exist.

Returns whether the entity has the component or not.

Removes a component from an entity.

Removes a component from an entity.

Accessor for the MeshStyle component, if it exists.

Accessor for the Transform component, if it exists.

Accessor for the Physics component, if it exists.

Accessor for the Render component, if it exists.

Accessor for the Joint component, if it exists.

Accessor for the D6Joint component, if it exists.

Accessor for the Camera component, if it exists.

Accessor for the Velocity component, if it exists.

Accessor for the Bounds component, if it exists.

Accessor for the Tag component, if it exists.

Accessor for the Layer component, if it exists.

Accessor for the PhysicsCharacter component, if it exists.

Accessor for the Sdf component, if it exists.

Accessor for the AudioSource component, if it exists.

Gets the raw entity id.

Gets the inner Entity

Retrieves the name of the entity

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.