Skip to content

Commit

Permalink
Use ShapeCastEasiest in smoke test to validate shape casting
Browse files Browse the repository at this point in the history
  • Loading branch information
LPGhatguy committed Oct 17, 2024
1 parent ef459a8 commit 4607f9c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/joltc-sys/JoltC
Submodule JoltC updated 2 files
+1 −0 JoltC/Functions.h
+42 −0 JoltC/JoltC.cpp
7 changes: 7 additions & 0 deletions crates/joltc-sys/tests/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ pub fn rmat44_identity() -> JPC_RMat44 {
}
}

pub fn rmat44_translation(col3: JPC_RVec3) -> JPC_RMat44 {
JPC_RMat44 {
col3,
..rmat44_identity()
}
}

fn global_init() {
use std::sync::OnceLock;

Expand Down
8 changes: 4 additions & 4 deletions crates/joltc-sys/tests/smoke_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,17 @@ impl SmokeTest for NarrowPhaseShapeCast {
ShapeCast: JPC_RShapeCast {
Shape: sphere_shape,
Scale: vec3(1.0, 1.0, 1.0),
CenterOfMassStart: rmat44_identity(),
Direction: vec3(1.0, 0.0, 0.0),
CenterOfMassStart: rmat44_translation(rvec3(-5.0, 2.0, 0.0)),
Direction: vec3(10.0, 0.0, 0.0),
..mem::zeroed()
},
Settings: Default::default(),
BaseOffset: vec3(0.0, 0.0, 0.0),
..mem::zeroed()
};
JPC_NarrowPhaseQuery_CastShape(query, &mut args);
let hit = JPC_NarrowPhaseQuery_CastShapeEasiest(query, &mut args);

// assert!(hit, "ray should hit the sphere");
assert!(hit, "sphere should hit the other sphere");
// assert!(
// (args.Result.Fraction - 0.25).abs() < 0.01,
// "ray should hit at around 0.25 fraction"
Expand Down

0 comments on commit 4607f9c

Please sign in to comment.