Struct Collision

Source
pub struct Collision {
    pub entry: LvdEntry,
    pub col_flags: ColFlags,
    pub vertices: Vec<Vector2>,
    pub normals: Vec<Vector2>,
    pub cliffs: Vec<CollisionCliff>,
    pub materials: Vec<CollisionMaterial>,
    pub unknowns: Vec<UnknownEntry>,
}
Expand description

A single collision in the level. Includes shape, ledges, collision material, flags about the collision properties, and all other properties of the collision.

Fields§

§entry: LvdEntry

The generic object data of the collision

§col_flags: ColFlags

The flags specifying certain aspects of the collision behavior (whether the collision is rigged to an animated bone, whether the platform can be dropped through, etc.)

§vertices: Vec<Vector2>

The vertices describing the shape of the collision

§normals: Vec<Vector2>

The collision “normals”, these are unit vectors describing the direction the collision is solid from. It effectively points “outward”. So a normal of Vector2(0.0, 1.0) means the collision is solid from the top side.

§cliffs: Vec<CollisionCliff>

Data describing grabbable ledges, internally called “cliffs”, present in this collision. This describes how far away the ledge can be grabbed from as well as what vertex/edge the cliff is a part of.

§materials: Vec<CollisionMaterial>

For each segment in the collision, describe the “material”. For example, a slippery stage may have a line_material of GroundCollAttr::GROUND_COLL_ATTR_ICE. This has no relation to graphical materials, only physics/sounds are affected by this.

§unknowns: Vec<UnknownEntry>

Trait Implementations§

Source§

impl BinRead for Collision

Source§

type Args = ()

The type used for the args parameter of read_args() and read_options(). Read more
Source§

fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_options: &ReadOptions, __binrw_generated_var_arguments: Self::Args, ) -> BinResult<Self>

Read Self from the reader using the given ReadOptions and arguments.
Source§

fn read<R>(reader: &mut R) -> Result<Self, Error>
where R: Read + Seek, Self::Args: Default,

Read Self from the reader using default arguments.
Source§

fn read_args<R>(reader: &mut R, args: Self::Args) -> Result<Self, Error>
where R: Read + Seek,

Read Self from the reader using the given arguments.
Source§

fn after_parse<R>( &mut self, _: &mut R, _: &ReadOptions, _: Self::Args, ) -> Result<(), Error>
where R: Read + Seek,

Runs any post-processing steps required to finalize construction of the object.
Source§

impl BinWrite for Collision

Source§

type Args = ()

The type of arguments needed to be supplied in order to write this type, usually a tuple. Read more
Source§

fn write_options<W: Write + Seek>( &self, writer: &mut W, options: &WriteOptions, _: Self::Args, ) -> Result<(), Error>

Write the type to a writer, given the options on how to write it and the type-specific arguments
Source§

fn write_to<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write + Seek, Self::Args: Default,

Write a type to a writer while assuming no arguments are needed.
Source§

fn write_with_args<W>( &self, writer: &mut W, args: Self::Args, ) -> Result<(), Error>
where W: Write + Seek,

Write the type to a writer while providing the default WriteOptions
Source§

impl Debug for Collision

Source§

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

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

impl HasMagic for Collision

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.