Compare commits
7 Commits
physics-bu
...
multi-coll
| Author | SHA1 | Date | |
|---|---|---|---|
|
567ca4b794
|
|||
|
6509bef070
|
|||
|
0fa097a004
|
|||
|
55d4b1d264
|
|||
|
ea28663e95
|
|||
|
bac9be9684
|
|||
|
7e76f3309b
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
/target
|
/target
|
||||||
|
.zed
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1677,8 +1677,10 @@ dependencies = [
|
|||||||
name = "integration-testing"
|
name = "integration-testing"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"glam",
|
||||||
"strafesnet_common",
|
"strafesnet_common",
|
||||||
"strafesnet_physics",
|
"strafesnet_physics",
|
||||||
|
"strafesnet_rbx_loader",
|
||||||
"strafesnet_snf",
|
"strafesnet_snf",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,13 @@ use strafesnet_common::physics::{Instruction,MouseInstruction,ModeInstruction,Mi
|
|||||||
//when the physics asks itself what happens next, this is how it's represented
|
//when the physics asks itself what happens next, this is how it's represented
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum InternalInstruction{
|
pub enum InternalInstruction{
|
||||||
CollisionStart(Collision,model_physics::GigaTime),
|
// begin accepting touch updates
|
||||||
CollisionEnd(Collision,model_physics::GigaTime),
|
OpenMultiCollision(model_physics::GigaTime),
|
||||||
|
// mutliple touch updates
|
||||||
|
CollisionStart(Collision),
|
||||||
|
CollisionEnd(Collision),
|
||||||
|
// confirm there will be no more touch updates and apply the transaction
|
||||||
|
CloseMultiCollision,
|
||||||
StrafeTick,
|
StrafeTick,
|
||||||
ReachWalkTargetVelocity,
|
ReachWalkTargetVelocity,
|
||||||
// Water,
|
// Water,
|
||||||
@@ -874,6 +879,9 @@ impl PhysicsState{
|
|||||||
..Self::default()
|
..Self::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub const fn body(&self)->&Body{
|
||||||
|
&self.body
|
||||||
|
}
|
||||||
pub fn camera_body(&self)->Body{
|
pub fn camera_body(&self)->Body{
|
||||||
Body{
|
Body{
|
||||||
position:self.body.position+self.style.camera_offset,
|
position:self.body.position+self.style.camera_offset,
|
||||||
@@ -949,8 +957,8 @@ pub struct PhysicsData{
|
|||||||
//cached calculations
|
//cached calculations
|
||||||
hitbox_mesh:HitboxMesh,
|
hitbox_mesh:HitboxMesh,
|
||||||
}
|
}
|
||||||
impl Default for PhysicsData{
|
impl PhysicsData{
|
||||||
fn default()->Self{
|
pub fn empty()->Self{
|
||||||
Self{
|
Self{
|
||||||
bvh:bvh::BvhNode::empty(),
|
bvh:bvh::BvhNode::empty(),
|
||||||
models:Default::default(),
|
models:Default::default(),
|
||||||
@@ -958,47 +966,7 @@ impl Default for PhysicsData{
|
|||||||
hitbox_mesh:StyleModifiers::default().calculate_mesh(),
|
hitbox_mesh:StyleModifiers::default().calculate_mesh(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
pub fn new(map:&map::CompleteMap)->Self{
|
||||||
// the collection of information required to run physics
|
|
||||||
pub struct PhysicsContext<'a>{
|
|
||||||
state:&'a mut PhysicsState,//this captures the entire state of the physics.
|
|
||||||
data:&'a PhysicsData,//data currently loaded into memory which is needded for physics to run, but is not part of the state.
|
|
||||||
}
|
|
||||||
// the physics consumes both Instruction and PhysicsInternalInstruction,
|
|
||||||
// but can only emit PhysicsInternalInstruction
|
|
||||||
impl InstructionConsumer<InternalInstruction> for PhysicsContext<'_>{
|
|
||||||
type Time=Time;
|
|
||||||
fn process_instruction(&mut self,ins:TimedInstruction<InternalInstruction,Time>){
|
|
||||||
atomic_internal_instruction(&mut self.state,&self.data,ins)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl InstructionConsumer<Instruction> for PhysicsContext<'_>{
|
|
||||||
type Time=Time;
|
|
||||||
fn process_instruction(&mut self,ins:TimedInstruction<Instruction,Time>){
|
|
||||||
atomic_input_instruction(&mut self.state,&self.data,ins)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl InstructionEmitter<InternalInstruction> for PhysicsContext<'_>{
|
|
||||||
type Time=Time;
|
|
||||||
//this little next instruction function could cache its return value and invalidate the cached value by watching the State.
|
|
||||||
fn next_instruction(&self,time_limit:Time)->Option<TimedInstruction<InternalInstruction,Time>>{
|
|
||||||
next_instruction_internal(&self.state,&self.data,time_limit)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl PhysicsContext<'_>{
|
|
||||||
pub fn run_input_instruction(
|
|
||||||
state:&mut PhysicsState,
|
|
||||||
data:&PhysicsData,
|
|
||||||
instruction:TimedInstruction<Instruction,Time>
|
|
||||||
){
|
|
||||||
let mut context=PhysicsContext{state,data};
|
|
||||||
context.process_exhaustive(instruction.time);
|
|
||||||
context.process_instruction(instruction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl PhysicsData{
|
|
||||||
/// use with caution, this is the only non-instruction way to mess with physics
|
|
||||||
pub fn generate_models(&mut self,map:&map::CompleteMap){
|
|
||||||
let modes=map.modes.clone().denormalize();
|
let modes=map.modes.clone().denormalize();
|
||||||
let mut used_contact_attributes=Vec::new();
|
let mut used_contact_attributes=Vec::new();
|
||||||
let mut used_intersect_attributes=Vec::new();
|
let mut used_intersect_attributes=Vec::new();
|
||||||
@@ -1125,11 +1093,50 @@ impl PhysicsData{
|
|||||||
(IntersectAttributesId::new(attr_id as u32),attr)
|
(IntersectAttributesId::new(attr_id as u32),attr)
|
||||||
).collect(),
|
).collect(),
|
||||||
};
|
};
|
||||||
self.bvh=bvh;
|
|
||||||
self.models=models;
|
|
||||||
self.modes=modes;
|
|
||||||
//hitbox_mesh is unchanged
|
|
||||||
println!("Physics Objects: {}",model_count);
|
println!("Physics Objects: {}",model_count);
|
||||||
|
Self{
|
||||||
|
hitbox_mesh:StyleModifiers::default().calculate_mesh(),
|
||||||
|
bvh,
|
||||||
|
models,
|
||||||
|
modes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// the collection of information required to run physics
|
||||||
|
pub struct PhysicsContext<'a>{
|
||||||
|
state:&'a mut PhysicsState,//this captures the entire state of the physics.
|
||||||
|
data:&'a PhysicsData,//data currently loaded into memory which is needded for physics to run, but is not part of the state.
|
||||||
|
}
|
||||||
|
// the physics consumes both Instruction and PhysicsInternalInstruction,
|
||||||
|
// but can only emit PhysicsInternalInstruction
|
||||||
|
impl InstructionConsumer<InternalInstruction> for PhysicsContext<'_>{
|
||||||
|
type Time=Time;
|
||||||
|
fn process_instruction(&mut self,ins:TimedInstruction<InternalInstruction,Time>){
|
||||||
|
atomic_internal_instruction(&mut self.state,&self.data,ins)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl InstructionConsumer<Instruction> for PhysicsContext<'_>{
|
||||||
|
type Time=Time;
|
||||||
|
fn process_instruction(&mut self,ins:TimedInstruction<Instruction,Time>){
|
||||||
|
atomic_input_instruction(&mut self.state,&self.data,ins)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl InstructionEmitter<InternalInstruction> for PhysicsContext<'_>{
|
||||||
|
type Time=Time;
|
||||||
|
//this little next instruction function could cache its return value and invalidate the cached value by watching the State.
|
||||||
|
fn next_instruction(&self,time_limit:Time)->Option<TimedInstruction<InternalInstruction,Time>>{
|
||||||
|
next_instruction_internal(&self.state,&self.data,time_limit)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl PhysicsContext<'_>{
|
||||||
|
pub fn run_input_instruction(
|
||||||
|
state:&mut PhysicsState,
|
||||||
|
data:&PhysicsData,
|
||||||
|
instruction:TimedInstruction<Instruction,Time>
|
||||||
|
){
|
||||||
|
let mut context=PhysicsContext{state,data};
|
||||||
|
context.process_exhaustive(instruction.time);
|
||||||
|
context.process_instruction(instruction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2124,4 +2131,115 @@ mod test{
|
|||||||
Time::ZERO
|
Time::ZERO
|
||||||
),None);
|
),None);
|
||||||
}
|
}
|
||||||
|
// overlap edges by 1 epsilon
|
||||||
|
#[test]
|
||||||
|
fn almost_miss_north(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
(int3(0,10,-7)>>1)+vec3::raw_xyz(0,0,1),
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),Some(Time::from_secs(2)))
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn almost_miss_east(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
(int3(7,10,0)>>1)+vec3::raw_xyz(-1,0,0),
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),Some(Time::from_secs(2)))
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn almost_miss_south(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
(int3(0,10,7)>>1)+vec3::raw_xyz(0,0,-1),
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),Some(Time::from_secs(2)))
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn almost_miss_west(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
(int3(-7,10,0)>>1)+vec3::raw_xyz(1,0,0),
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),Some(Time::from_secs(2)))
|
||||||
|
}
|
||||||
|
// exactly miss edges
|
||||||
|
#[test]
|
||||||
|
fn exact_miss_north(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
int3(0,10,-7)>>1,
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),None)
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn exact_miss_east(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
int3(7,10,0)>>1,
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),None)
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn exact_miss_south(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
int3(0,10,7)>>1,
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),None)
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn exact_miss_west(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
int3(-7,10,0)>>1,
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),None)
|
||||||
|
}
|
||||||
|
// miss edges by 1 epsilon
|
||||||
|
#[test]
|
||||||
|
fn narrow_miss_north(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
(int3(0,10,-7)>>1)-vec3::raw_xyz(0,0,1),
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),None)
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn narrow_miss_east(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
(int3(7,10,0)>>1)-vec3::raw_xyz(-1,0,0),
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),None)
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn narrow_miss_south(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
(int3(0,10,7)>>1)-vec3::raw_xyz(0,0,-1),
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),None)
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn narrow_miss_west(){
|
||||||
|
test_collision_axis_aligned(Body::new(
|
||||||
|
(int3(-7,10,0)>>1)-vec3::raw_xyz(1,0,0),
|
||||||
|
int3(0,-1,0),
|
||||||
|
vec3::ZERO,
|
||||||
|
Time::ZERO
|
||||||
|
),None)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ impl Session{
|
|||||||
user_settings,
|
user_settings,
|
||||||
directories,
|
directories,
|
||||||
mouse_interpolator:MouseInterpolator::new(),
|
mouse_interpolator:MouseInterpolator::new(),
|
||||||
geometry_shared:Default::default(),
|
geometry_shared:PhysicsData::empty(),
|
||||||
simulation,
|
simulation,
|
||||||
view_state:ViewState::Play,
|
view_state:ViewState::Play,
|
||||||
recording:Default::default(),
|
recording:Default::default(),
|
||||||
@@ -184,7 +184,7 @@ impl Session{
|
|||||||
}
|
}
|
||||||
fn change_map(&mut self,map:&strafesnet_common::map::CompleteMap){
|
fn change_map(&mut self,map:&strafesnet_common::map::CompleteMap){
|
||||||
self.simulation.physics.clear();
|
self.simulation.physics.clear();
|
||||||
self.geometry_shared.generate_models(map);
|
self.geometry_shared=PhysicsData::new(map);
|
||||||
}
|
}
|
||||||
pub fn get_frame_state(&self,time:SessionTime)->Option<FrameState>{
|
pub fn get_frame_state(&self,time:SessionTime)->Option<FrameState>{
|
||||||
match &self.view_state{
|
match &self.view_state{
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
glam = "0.30.0"
|
||||||
strafesnet_common = { path = "../lib/common", registry = "strafesnet" }
|
strafesnet_common = { path = "../lib/common", registry = "strafesnet" }
|
||||||
strafesnet_physics = { path = "../engine/physics", registry = "strafesnet" }
|
strafesnet_physics = { path = "../engine/physics", registry = "strafesnet" }
|
||||||
strafesnet_snf = { path = "../lib/snf", registry = "strafesnet" }
|
strafesnet_snf = { path = "../lib/snf", registry = "strafesnet" }
|
||||||
|
# this is just for the primitive constructor
|
||||||
|
strafesnet_rbx_loader = { path = "../lib/rbx_loader", registry = "strafesnet" }
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ mod util;
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_scenes;
|
||||||
|
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
@@ -29,9 +31,8 @@ fn run_replay()->Result<(),ReplayError>{
|
|||||||
let bot=strafesnet_snf::read_bot(data)?.read_all()?;
|
let bot=strafesnet_snf::read_bot(data)?.read_all()?;
|
||||||
|
|
||||||
// create recording
|
// create recording
|
||||||
let mut physics_data=PhysicsData::default();
|
|
||||||
println!("generating models..");
|
println!("generating models..");
|
||||||
physics_data.generate_models(&map);
|
let physics_data=PhysicsData::new(&map);
|
||||||
println!("simulating...");
|
println!("simulating...");
|
||||||
let mut physics=PhysicsState::default();
|
let mut physics=PhysicsState::default();
|
||||||
for ins in bot.instructions{
|
for ins in bot.instructions{
|
||||||
@@ -139,9 +140,8 @@ fn test_determinism()->Result<(),ReplayError>{
|
|||||||
let data=read_entire_file("../tools/bhop_maps/5692113331.snfm")?;
|
let data=read_entire_file("../tools/bhop_maps/5692113331.snfm")?;
|
||||||
let map=strafesnet_snf::read_map(data)?.into_complete_map()?;
|
let map=strafesnet_snf::read_map(data)?.into_complete_map()?;
|
||||||
|
|
||||||
let mut physics_data=PhysicsData::default();
|
|
||||||
println!("generating models..");
|
println!("generating models..");
|
||||||
physics_data.generate_models(&map);
|
let physics_data=PhysicsData::new(&map);
|
||||||
|
|
||||||
let (send,recv)=std::sync::mpsc::channel();
|
let (send,recv)=std::sync::mpsc::channel();
|
||||||
|
|
||||||
|
|||||||
91
integration-testing/src/test_scenes.rs
Normal file
91
integration-testing/src/test_scenes.rs
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
use strafesnet_physics::physics::{PhysicsData,PhysicsState,PhysicsContext};
|
||||||
|
use strafesnet_common::gameplay_modes::NormalizedModes;
|
||||||
|
use strafesnet_common::gameplay_attributes::{CollisionAttributes,CollisionAttributesId};
|
||||||
|
use strafesnet_common::integer::{vec3,mat3,Planar64Affine3,Time};
|
||||||
|
use strafesnet_common::model::{Mesh,Model,MeshId,ModelId,RenderConfigId};
|
||||||
|
use strafesnet_common::map::CompleteMap;
|
||||||
|
use strafesnet_common::physics::Instruction;
|
||||||
|
use strafesnet_common::instruction::TimedInstruction;
|
||||||
|
use strafesnet_rbx_loader::primitives::{unit_cube,CubeFaceDescription};
|
||||||
|
|
||||||
|
struct TestSceneBuilder{
|
||||||
|
meshes:Vec<Mesh>,
|
||||||
|
models:Vec<Model>,
|
||||||
|
}
|
||||||
|
impl TestSceneBuilder{
|
||||||
|
fn new()->Self{
|
||||||
|
Self{
|
||||||
|
meshes:Vec::new(),
|
||||||
|
models:Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn push_mesh(&mut self,mesh:Mesh)->MeshId{
|
||||||
|
let mesh_id=self.meshes.len();
|
||||||
|
self.meshes.push(mesh);
|
||||||
|
MeshId::new(mesh_id as u32)
|
||||||
|
}
|
||||||
|
fn push_mesh_instance(&mut self,mesh:MeshId,transform:Planar64Affine3)->ModelId{
|
||||||
|
let model=Model{
|
||||||
|
mesh,
|
||||||
|
attributes:CollisionAttributesId::new(0),
|
||||||
|
color:glam::Vec4::ONE,
|
||||||
|
transform,
|
||||||
|
};
|
||||||
|
let model_id=self.models.len();
|
||||||
|
self.models.push(model);
|
||||||
|
ModelId::new(model_id as u32)
|
||||||
|
}
|
||||||
|
fn build(self)->PhysicsData{
|
||||||
|
let modes=NormalizedModes::new(Vec::new());
|
||||||
|
let attributes=vec![CollisionAttributes::contact_default()];
|
||||||
|
let meshes=self.meshes;
|
||||||
|
let models=self.models;
|
||||||
|
let textures=Vec::new();
|
||||||
|
let render_configs=Vec::new();
|
||||||
|
PhysicsData::new(&CompleteMap{
|
||||||
|
modes,
|
||||||
|
attributes,
|
||||||
|
meshes,
|
||||||
|
models,
|
||||||
|
textures,
|
||||||
|
render_configs,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_scene()->PhysicsData{
|
||||||
|
let mut builder=TestSceneBuilder::new();
|
||||||
|
let cube_face_description=CubeFaceDescription::new(Default::default(),RenderConfigId::new(0));
|
||||||
|
let mesh=builder.push_mesh(unit_cube(cube_face_description));
|
||||||
|
// place two 5x5x5 cubes.
|
||||||
|
builder.push_mesh_instance(mesh,Planar64Affine3::new(
|
||||||
|
mat3::from_diagonal(vec3::int(5,5,5)>>1),
|
||||||
|
vec3::int(0,0,0)
|
||||||
|
));
|
||||||
|
builder.push_mesh_instance(mesh,Planar64Affine3::new(
|
||||||
|
mat3::from_diagonal(vec3::int(5,5,5)>>1),
|
||||||
|
vec3::int(5,-5,0)
|
||||||
|
));
|
||||||
|
builder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn simultaneous_collision(){
|
||||||
|
let physics_data=test_scene();
|
||||||
|
let body=strafesnet_physics::physics::Body::new(
|
||||||
|
vec3::int(5+1,1,0),
|
||||||
|
vec3::int(-1,-1,0),
|
||||||
|
vec3::int(0,0,0),
|
||||||
|
Time::ZERO,
|
||||||
|
);
|
||||||
|
let mut physics=PhysicsState::new_with_body(body);
|
||||||
|
PhysicsContext::run_input_instruction(&mut physics,&physics_data,TimedInstruction{
|
||||||
|
time:Time::from_secs(2),
|
||||||
|
instruction:Instruction::Idle,
|
||||||
|
});
|
||||||
|
let body=physics.body();
|
||||||
|
assert_eq!(body.position,vec3::int(5,0,0));
|
||||||
|
assert_eq!(body.velocity,vec3::int(0,0,0));
|
||||||
|
assert_eq!(body.acceleration,vec3::int(0,0,0));
|
||||||
|
assert_eq!(body.time,Time::ONE_SECOND);
|
||||||
|
}
|
||||||
@@ -10,9 +10,8 @@ fn physics_bug_2()->Result<(),ReplayError>{
|
|||||||
let map=strafesnet_snf::read_map(data)?.into_complete_map()?;
|
let map=strafesnet_snf::read_map(data)?.into_complete_map()?;
|
||||||
|
|
||||||
// create recording
|
// create recording
|
||||||
let mut physics_data=PhysicsData::default();
|
|
||||||
println!("generating models..");
|
println!("generating models..");
|
||||||
physics_data.generate_models(&map);
|
let physics_data=PhysicsData::new(&map);
|
||||||
println!("simulating...");
|
println!("simulating...");
|
||||||
|
|
||||||
//teleport to bug
|
//teleport to bug
|
||||||
@@ -45,9 +44,8 @@ fn physics_bug_3()->Result<(),ReplayError>{
|
|||||||
let map=strafesnet_snf::read_map(data)?.into_complete_map()?;
|
let map=strafesnet_snf::read_map(data)?.into_complete_map()?;
|
||||||
|
|
||||||
// create recording
|
// create recording
|
||||||
let mut physics_data=PhysicsData::default();
|
|
||||||
println!("generating models..");
|
println!("generating models..");
|
||||||
physics_data.generate_models(&map);
|
let physics_data=PhysicsData::new(&map);
|
||||||
println!("simulating...");
|
println!("simulating...");
|
||||||
|
|
||||||
//teleport to bug
|
//teleport to bug
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ use crate::integer::{vec3,Planar64Vec3};
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Aabb{
|
pub struct Aabb{
|
||||||
|
// min is inclusive
|
||||||
min:Planar64Vec3,
|
min:Planar64Vec3,
|
||||||
|
// max is not inclusive
|
||||||
max:Planar64Vec3,
|
max:Planar64Vec3,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ impl Aabb{
|
|||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn contains(&self,point:Planar64Vec3)->bool{
|
pub fn contains(&self,point:Planar64Vec3)->bool{
|
||||||
let bvec=self.min.lt(point)&point.lt(self.max);
|
let bvec=self.min.le(point)&point.lt(self.max);
|
||||||
bvec.all()
|
bvec.all()
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ mod mesh;
|
|||||||
mod error;
|
mod error;
|
||||||
mod union;
|
mod union;
|
||||||
pub mod loader;
|
pub mod loader;
|
||||||
mod primitives;
|
pub mod primitives;
|
||||||
|
|
||||||
pub mod data{
|
pub mod data{
|
||||||
pub struct RobloxMeshBytes(Vec<u8>);
|
pub struct RobloxMeshBytes(Vec<u8>);
|
||||||
|
|||||||
Reference in New Issue
Block a user