Struct ark_api::world::EntityOwned
source · [−]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
sourceimpl EntityOwned
impl EntityOwned
sourcepub fn create_empty(name: &str) -> Self
pub fn create_empty(name: &str) -> Self
Creates an empty world entity with just a name.
Add components of your preference to it.
sourcepub fn create_non_physics(name: &str) -> Self
pub fn create_non_physics(name: &str) -> Self
sourcepub fn create_camera(name: &str) -> Self
pub fn create_camera(name: &str) -> Self
sourcepub fn clone_entity(&self, name: &str) -> Self
pub fn clone_entity(&self, name: &str) -> Self
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.
sourcepub fn add_component(&self, component_type: ComponentType)
pub fn add_component(&self, component_type: ComponentType)
Adds a component to an entity.
sourcepub fn add<T: ComponentTrait>(&self) -> T
pub fn add<T: ComponentTrait>(&self) -> T
Adds a component to an entity.
sourcepub fn copy_component(&self, src: Entity, component_type: ComponentType)
pub fn copy_component(&self, src: Entity, component_type: ComponentType)
Copies a component from the entity in src
.
sourcepub fn copy<T: ComponentTrait>(&self, src: Entity) -> T
pub fn copy<T: ComponentTrait>(&self, src: Entity) -> T
Copies a component from the entity in src
.
sourcepub fn has<T: ComponentTrait>(&self) -> bool
pub fn has<T: ComponentTrait>(&self) -> bool
Returns whether the entity has the component or not.
sourcepub fn get<T: ComponentTrait>(&self) -> Option<T>
pub fn get<T: ComponentTrait>(&self) -> Option<T>
Gets an interface to the component.
Returns an option, none if the component doesn’t exist.
sourcepub fn has_component(&self, component_type: ComponentType) -> bool
pub fn has_component(&self, component_type: ComponentType) -> bool
Returns whether the entity has the component or not.
sourcepub fn remove_component(&self, component_type: ComponentType)
pub fn remove_component(&self, component_type: ComponentType)
Removes a component from an entity.
sourcepub fn remove<T: ComponentTrait>(&self)
pub fn remove<T: ComponentTrait>(&self)
Removes a component from an entity.
sourcepub fn mesh_style(&self) -> MeshStyle
pub fn mesh_style(&self) -> MeshStyle
Accessor for the MeshStyle
component, if it exists.
sourcepub fn physics_character(&self) -> PhysicsCharacter
pub fn physics_character(&self) -> PhysicsCharacter
Accessor for the PhysicsCharacter
component, if it exists.
sourcepub fn audio_source(&self) -> AudioSource
pub fn audio_source(&self) -> AudioSource
Accessor for the AudioSource
component, if it exists.
sourcepub fn as_ffi(&self) -> EntityHandle
pub fn as_ffi(&self) -> EntityHandle
Gets the raw entity id.
Trait Implementations
sourceimpl AsRef<Entity> for EntityOwned
impl AsRef<Entity> for EntityOwned
sourceimpl Debug for EntityOwned
impl Debug for EntityOwned
sourceimpl Drop for EntityOwned
impl Drop for EntityOwned
sourceimpl From<&EntityOwned> for Entity
impl From<&EntityOwned> for Entity
sourcefn from(item: &EntityOwned) -> Self
fn from(item: &EntityOwned) -> Self
Converts to this type from the input type.
sourceimpl Hash for EntityOwned
impl Hash for EntityOwned
sourceimpl PartialEq<EntityOwned> for EntityOwned
impl PartialEq<EntityOwned> for EntityOwned
sourcefn eq(&self, other: &EntityOwned) -> bool
fn eq(&self, other: &EntityOwned) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Eq for EntityOwned
impl StructuralEq for EntityOwned
impl StructuralPartialEq for EntityOwned
Auto Trait Implementations
impl RefUnwindSafe for EntityOwned
impl Send for EntityOwned
impl Sync for EntityOwned
impl Unpin for EntityOwned
impl UnwindSafe for EntityOwned
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more