pub struct Geometry {
pub obj: GeometryInner,
}
Expand description
Geometry object defines the characteristics of a spatial object.
Fields§
§obj: GeometryInner
Implementations§
Source§impl Geometry
impl Geometry
pub fn ball(radius: f32) -> Self
Sphere
primitive (e.g. using Geometry::from
)pub fn halfspace(outward_normal: Vec3) -> Self
Plane3d
primitive (e.g. using Geometry::from
)pub fn capsule(half_height: f32, radius: f32) -> Self
Capsule3d
primitive (e.g. using Geometry::from
)pub fn cuboid(half_x: f32, half_y: f32, half_z: f32) -> Self
Cuboid
primitive (e.g. using Geometry::from
)pub fn convex_mesh( physics: &mut Physics, verts: &[Vec3], ) -> Result<Self, ConvexMeshCookingError>
pub fn trimesh( physics: &mut Physics, verts: &[Vec3], indices: &[[u32; 3]], ) -> Result<Self, TriangleMeshCookingError>
pub fn cylinder( physics: &mut Physics, half_height: f32, radius: f32, segments: usize, ) -> Result<Self, ConvexMeshCookingError>
pub fn heightfield( physics: &mut Physics, heights: &[i16], num_rows: usize, num_cols: usize, ) -> Self
Sourcepub fn bevy_trimesh(
physics: &mut Physics,
mesh: &Mesh,
) -> Result<Self, TriangleMeshCookingError>
pub fn bevy_trimesh( physics: &mut Physics, mesh: &Mesh, ) -> Result<Self, TriangleMeshCookingError>
Sourcepub fn bevy_convex_mesh(
physics: &mut Physics,
mesh: &Mesh,
) -> Result<Self, ConvexMeshCookingError>
pub fn bevy_convex_mesh( physics: &mut Physics, mesh: &Mesh, ) -> Result<Self, ConvexMeshCookingError>
Convert bevy’s Mesh
to Geometry
, assuming
it’s a convex mesh.
Also see convex_mesh
.
Sourcepub fn with_scale(self, scale: Vec3, rotation: Quat) -> Self
pub fn with_scale(self, scale: Vec3, rotation: Quat) -> Self
Apply scale factor to an existing mesh (convex, triangle or heightfield).
Only applicable to ConvexMesh, TriangleMesh or HeightField.
Using this function, you can cook a mesh once, then insert it into scene with different scale factors.
- scale - Scaling factor (use
Vec3::splat(2)
to scale up 2x). - rotation - The orientation of the scaling axes (usually
Quat::IDENTITY
, ignored for HeightField).
Sourcepub fn with_tight_bounds(self, tight_bounds: bool) -> Self
pub fn with_tight_bounds(self, tight_bounds: bool) -> Self
Use tighter (but more expensive to compute) bounds around the geometry.
Only applicable to ConvexMesh, TriangleMesh or HeightField.
It is enabled by default, use .with_tight_bounds(false)
to disable.
Sourcepub fn with_double_sided(self, double_sided: bool) -> Self
pub fn with_double_sided(self, double_sided: bool) -> Self
Meshes with this flag set are treated as double-sided.
Only applicable to TriangleMesh or HeightField.
This flag is currently only used for raycasts and sweeps (it is ignored for overlap queries). For detailed specifications of this flag for meshes and heightfields please refer to the Geometry Query section of the PhysX user guide.
Trait Implementations§
Source§impl From<Owner<ConvexMesh>> for Geometry
impl From<Owner<ConvexMesh>> for Geometry
Source§fn from(value: Owner<ConvexMesh>) -> Self
fn from(value: Owner<ConvexMesh>) -> Self
Source§impl From<Owner<HeightField>> for Geometry
impl From<Owner<HeightField>> for Geometry
Source§fn from(value: Owner<HeightField>) -> Self
fn from(value: Owner<HeightField>) -> Self
Source§impl From<Owner<TriangleMesh>> for Geometry
impl From<Owner<TriangleMesh>> for Geometry
Source§fn from(value: Owner<TriangleMesh>) -> Self
fn from(value: Owner<TriangleMesh>) -> Self
Source§impl From<PxBoxGeometry> for Geometry
impl From<PxBoxGeometry> for Geometry
Source§fn from(value: PxBoxGeometry) -> Self
fn from(value: PxBoxGeometry) -> Self
Source§impl From<PxCapsuleGeometry> for Geometry
impl From<PxCapsuleGeometry> for Geometry
Source§fn from(value: PxCapsuleGeometry) -> Self
fn from(value: PxCapsuleGeometry) -> Self
Source§impl From<PxPlaneGeometry> for Geometry
impl From<PxPlaneGeometry> for Geometry
Source§fn from(value: PxPlaneGeometry) -> Self
fn from(value: PxPlaneGeometry) -> Self
Source§impl From<PxSphereGeometry> for Geometry
impl From<PxSphereGeometry> for Geometry
Source§fn from(value: PxSphereGeometry) -> Self
fn from(value: PxSphereGeometry) -> Self
Source§impl TypePath for Geometry
impl TypePath for Geometry
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Source§impl VisitAssetDependencies for Geometry
impl VisitAssetDependencies for Geometry
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))
impl Asset for Geometry
Auto Trait Implementations§
impl Freeze for Geometry
impl RefUnwindSafe for Geometry
impl Send for Geometry
impl Sync for Geometry
impl Unpin for Geometry
impl UnwindSafe for Geometry
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.Source§impl<A> AssetContainer for Awhere
A: Asset,
impl<A> AssetContainer for Awhere
A: Asset,
fn insert(self: Box<A>, id: UntypedAssetId, world: &mut World)
fn asset_type_name(&self) -> &'static str
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
, which can then be
downcast
into Box<dyn 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>
, which 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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path
.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident
.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name
.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more