pub struct CircleVisual { /* private fields */ }Expand description
Filled world-space circle rendered by the standard Sim;Engine bridge.
Radius uses caller-defined world units. Layer controls primary draw order;
lower layers are drawn first. Within one layer, lower draw-order depth is
drawn first, followed by stable entity identity as the final tie-breaker.
Spawning this component without a Transform2d automatically inserts a
default transform at the world origin. The canonical translation of a
transform supplied in the same bundle takes precedence; normal spawn
snapping may reset its previous interpolation endpoint to that translation.
Implementations§
Source§impl CircleVisual
impl CircleVisual
Sourcepub const fn with_matching_collider(self) -> (Self, CircleCollider2d)
pub const fn with_matching_collider(self) -> (Self, CircleCollider2d)
Returns (visual, collider) as a spawnable pair matching this radius.
The collider is a one-time geometry snapshot produced by
CircleCollider2d::from_visual. Later changes to either returned
value remain independent. The tuple can be nested directly in a larger
spawn bundle.
Source§impl CircleVisual
impl CircleVisual
Sourcepub fn new(radius: f32, color: Color) -> Result<Self, VisualValueError>
pub fn new(radius: f32, color: Color) -> Result<Self, VisualValueError>
Creates a filled circle on the default layer and draw-order depth zero.
Sourcepub const fn draw_order_depth(&self) -> f32
pub const fn draw_order_depth(&self) -> f32
Returns the within-layer draw-order depth.
This value affects ordering only. It is not Sim;Engine pseudo-depth and does not change camera projection.
Sourcepub fn set_radius(&mut self, radius: f32) -> Result<(), VisualValueError>
pub fn set_radius(&mut self, radius: f32) -> Result<(), VisualValueError>
Replaces the world-space radius after validation.
Sourcepub fn set_color(&mut self, color: Color) -> Result<(), VisualValueError>
pub fn set_color(&mut self, color: Color) -> Result<(), VisualValueError>
Replaces the fill color after normalized-color validation.
Sourcepub fn set_draw_order_depth(
&mut self,
depth: f32,
) -> Result<(), VisualValueError>
pub fn set_draw_order_depth( &mut self, depth: f32, ) -> Result<(), VisualValueError>
Replaces within-layer draw depth after finite-value validation.
Trait Implementations§
Source§impl Clone for CircleVisual
impl Clone for CircleVisual
Source§impl Component for CircleVisual
Required Components: Transform2d.
impl Component for CircleVisual
Required Components: Transform2d.
A component’s Required Components are inserted whenever it is inserted. Note that this will also insert the required components of the required components, recursively, in depth-first order.
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreimpl Copy for CircleVisual
Source§impl Debug for CircleVisual
impl Debug for CircleVisual
Source§impl PartialEq for CircleVisual
impl PartialEq for CircleVisual
impl StructuralPartialEq for CircleVisual
Auto Trait Implementations§
impl Freeze for CircleVisual
impl RefUnwindSafe for CircleVisual
impl Send for CircleVisual
impl Sync for CircleVisual
impl Unpin for CircleVisual
impl UnsafeUnpin for CircleVisual
impl UnwindSafe for CircleVisual
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.