Skip to main content

Prop

Struct Prop 

Source
pub struct Prop {
Show 16 fields pub asset_id: AssetId, pub model: Option<AssetId>, pub mesh: Option<MeshHandle>, pub material: Option<MaterialHandle>, pub texture: Option<TextureHandle>, pub position: [f32; 3], pub rotation_deg: [f32; 3], pub scale: [f32; 3], pub collider: Option<PropCollider>, pub interactable: bool, pub pickup: bool, pub parent: Option<AssetId>, pub scene: Option<AssetId>, pub prefab: String, pub cull_distance: f32, pub is_held: bool,
}
Expand description

A scene object: places geometry at a world-space transform.

Reference either a Model (multi-mesh) or a single Mesh/ProceduralMesh. model takes precedence when both are set.

Rotation notes:

  • rotation_deg[0] = pitch (tilt forward/back)
  • rotation_deg[1] = yaw (spin on vertical axis), most common
  • rotation_deg[2] = roll (tilt side-to-side)
Prop {
    position: [4.0, 0.4, -8.0],
    ..Default::default()
};

Fields§

§asset_id: AssetId

Asset identity; injected via inject_name. Not part of args.

§model: Option<AssetId>

A Model asset. When set, the prop renders all sub-meshes of that model (each with its own material) sharing this prop’s transform. Takes precedence over mesh and material.

§mesh: Option<MeshHandle>

A Mesh or ProceduralMesh asset this prop renders. Used when model is unset.

§material: Option<MaterialHandle>

A Material to use for this prop. When set it takes precedence over texture and provides the albedo texture plus the lighting parameters (roughness, metallic, tint, emissive). Used when model is unset.

§texture: Option<TextureHandle>

A Texture to use for this prop. Older field: ignored when material is set. Unset uses the first declared texture (or a white fallback).

§position: [f32; 3]

World-space position [x, y, z].

§rotation_deg: [f32; 3]

Euler rotation in degrees [pitch, yaw, roll], applied in YXZ order (yaw first so that rotating around the vertical axis is intuitive).

§scale: [f32; 3]

Non-uniform scale [x, y, z]. Defaults to [1, 1, 1].

§collider: Option<PropCollider>

Optional collision volume. When present, the prop blocks the player; when absent the prop is non-solid.

§interactable: bool

When true, the player can interact with this prop: pressing the interact key (E) while close and facing it triggers its rotation behaviour.

§pickup: bool

When true, the player can pick up and carry this prop with the interact key (E). A companion PropBody must also be declared so the prop falls correctly after being dropped.

§parent: Option<AssetId>

Another Prop whose world transform this prop inherits. When set, position, rotation_deg, and scale are relative to the parent’s world transform. The parent must be declared in the same world; circular chains are treated as an error.

§scene: Option<AssetId>

Scene this prop belongs to. Resolved automatically from the naming convention (a prop named <scene>_* belongs to scene <scene>); you don’t set this directly. None means the prop is visible in every scene. Used by scene switches for per-scene visibility.

§prefab: String

Name of a Prefab to instantiate at this prop’s transform. When set, it expands into concrete child props and lights, replacing this prop. Cannot be combined with model or mesh.

§cull_distance: f32

Optional view-distance cutoff in world units. When > 0 the prop is hidden once the camera is further than this from it. 0 (default) keeps the prop visible at any distance.

§is_held: bool

Set at runtime while the prop is being carried. Not serialised. While true, PhysicsSystem drives the prop as a kinematic body that follows the camera instead of simulating it dynamically.

Trait Implementations§

Source§

impl Clone for Prop

Source§

fn clone(&self) -> Prop

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Component for Prop

Source§

const NAME: &'static str = "Prop"

The registry name a world authors this component under.
Source§

fn inject_name(&mut self, id: AssetId)

Called after construction to inject the asset’s identity from the blob def. Only meaningful for components that look themselves up by id at runtime. The default implementation does nothing.
Source§

fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>

Reconstruct this component from a blob record, whose bytes are the serialized runtime component (cook already ran the asset -> component translation). The default rejects: runtime-only components are never stored in a blob, so only loadable types provide an implementation.
Source§

fn inject_locator(&mut self, _locator: PayloadLocator)

Called after construction to inject the payload locator from the blob def. Only meaningful for components with a compiled payload. The default implementation does nothing (correct for most components).
Source§

impl ComponentSlot for Prop

Source§

const DISCRIMINANT: u8

The component type’s stable id, used as its ComponentId.
Source§

fn slot(s: &ComponentStorage) -> &Column<Self>

Borrow this type’s column out of the storage.
Source§

fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>

Mutably borrow this type’s column out of the storage.
Source§

impl Debug for Prop

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Prop

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Prop
where Prop: Default,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Prop> for ComponentAsset

Source§

fn from(c: Prop) -> Self

Converts to this type from the input type.
Source§

impl RuntimeComponent for Prop

Source§

impl Serialize for Prop

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Prop

§

impl RefUnwindSafe for Prop

§

impl Send for Prop

§

impl Sync for Prop

§

impl Unpin for Prop

§

impl UnsafeUnpin for Prop

§

impl UnwindSafe for Prop

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.