pub struct RigidBody {
pub handle: Option<RigidBodyHandle>,
pub body_type: BodyType,
pub mass: f32,
pub ccd_enabled: bool,
pub linear_velocity: Vec3,
pub angular_velocity: Vec3,
}Expand description
Component representing a rigid body in the physics simulation.
Fields§
§handle: Option<RigidBodyHandle>Opaque handle used by the physics provider.
body_type: BodyTypeGlobal type of the body (Static, Dynamic, Kinematic).
mass: f32Mass of the body in kilograms.
ccd_enabled: boolWhether to enable Continuous Collision Detection (CCD).
linear_velocity: Vec3Current linear velocity.
angular_velocity: Vec3Current angular velocity.
Implementations§
Source§impl RigidBody
impl RigidBody
Sourcepub fn new_dynamic(mass: f32) -> Self
pub fn new_dynamic(mass: f32) -> Self
Creates a new dynamic rigid body.
Sourcepub fn new_static() -> Self
pub fn new_static() -> Self
Creates a new static rigid body.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RigidBody
impl<'de> Deserialize<'de> for RigidBody
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Component for RigidBody
Auto Trait Implementations§
impl Freeze for RigidBody
impl RefUnwindSafe for RigidBody
impl Send for RigidBody
impl Sync for RigidBody
impl Unpin for RigidBody
impl UnwindSafe for RigidBody
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C1> ComponentBundle for C1where
C1: Component,
impl<C1> ComponentBundle for C1where
C1: Component,
Source§fn type_ids() -> Vec<TypeId>
fn type_ids() -> Vec<TypeId>
Returns the sorted list of
TypeIds for the components in this bundle. Read moreSource§fn create_columns() -> HashMap<TypeId, Box<dyn AnyVec>>
fn create_columns() -> HashMap<TypeId, Box<dyn AnyVec>>
Creates the set of empty, type-erased
Vec<T> columns required to store
this bundle’s components. Read moreSource§fn update_metadata(
metadata: &mut EntityMetadata,
location: PageIndex,
registry: &ComponentRegistry,
)
fn update_metadata( metadata: &mut EntityMetadata, location: PageIndex, registry: &ComponentRegistry, )
Updates the appropriate fields in an
EntityMetadata struct to point
to the location of this bundle’s data. Read moreSource§unsafe fn add_to_page(self, page: &mut ComponentPage)
unsafe fn add_to_page(self, page: &mut ComponentPage)
Adds the components from this bundle into the specified
ComponentPage. Read more