-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d916f70
commit 03b1806
Showing
34 changed files
with
487 additions
and
123 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use super::collision_solid::Flags; | ||
use super::prelude::*; | ||
|
||
#[derive(Debug, Default)] | ||
#[allow(dead_code)] | ||
pub(crate) struct CollisionCapsule { | ||
flags: Flags, | ||
effective_normal: Vec3, | ||
a: Vec3, | ||
b: Vec3, | ||
radius: f32, | ||
length: f32, | ||
} | ||
|
||
impl CollisionCapsule { | ||
#[inline] | ||
pub fn create(loader: &mut BinaryAsset, data: &mut Datagram) -> Result<Self, bam::Error> { | ||
let solid = CollisionSolid::create(loader, data)?; | ||
|
||
let a = Vec3::read(data)?; | ||
let b = Vec3::read(data)?; | ||
let radius = data.read_float()?; | ||
|
||
let mut capsule = Self { | ||
flags: solid.flags, | ||
effective_normal: solid.effective_normal, | ||
a, | ||
b, | ||
radius, | ||
..Default::default() | ||
}; | ||
|
||
capsule.recalc_internals(); | ||
|
||
Ok(capsule) | ||
} | ||
|
||
fn recalc_internals(&mut self) { | ||
self.length = (self.b - self.a).length(); | ||
//TODO: calculate the matrix | ||
} | ||
} |
Oops, something went wrong.