diff --git a/src/body.rs b/src/body.rs index 193ae76..403f52e 100644 --- a/src/body.rs +++ b/src/body.rs @@ -474,9 +474,9 @@ impl ModelPhysics { } pub fn from_model(model:&crate::model::IndexedModel,instance:&crate::model::ModelInstance) -> Option { match &instance.attributes{ - crate::model::CollisionAttributes::Decoration=>None, crate::model::CollisionAttributes::Contact{contacting,general}=>Some(ModelPhysics::from_model_transform_attributes(model,&instance.transform,PhysicsCollisionAttributes::Contact{contacting:contacting.clone(),general:general.clone()})), - crate::model::CollisionAttributes::Intersect{intersecting,general}=>None,//Some(ModelPhysics::from_model_transform_attributes(model,&instance.transform,PhysicsCollisionAttributes::Intersecting{intersecting,general})), + crate::model::CollisionAttributes::Intersect{intersecting,general}=>Some(ModelPhysics::from_model_transform_attributes(model,&instance.transform,PhysicsCollisionAttributes::Intersect{intersecting:intersecting.clone(),general:general.clone()})), + crate::model::CollisionAttributes::Decoration=>None, } } pub fn unit_vertices(&self) -> [glam::Vec3;8] { diff --git a/src/load_roblox.rs b/src/load_roblox.rs index bb10df4..2e7beb6 100644 --- a/src/load_roblox.rs +++ b/src/load_roblox.rs @@ -30,7 +30,7 @@ fn get_texture_refs(dom:&rbx_dom_weak::WeakDom) -> Vec //next class objects } -fn get_attributes(name:&str,can_collide:bool,velocity:glam::Vec3)->crate::model::CollisionAttributes{ +fn get_attributes(name:&str,can_collide:bool,velocity:glam::Vec3,force_intersecting:bool)->crate::model::CollisionAttributes{ let mut general=crate::model::GameMechanicAttributes::default(); let mut intersecting=crate::model::IntersectingAttributes::default(); let mut contacting=crate::model::ContactingAttributes::default(); @@ -89,9 +89,21 @@ fn get_attributes(name:&str,can_collide:bool,velocity:glam::Vec3)->crate::model: //WormholeIn# } } - return crate::model::CollisionAttributes::Contact{contacting,general}; + crate::model::CollisionAttributes::Contact{contacting,general} + }, + false=>if force_intersecting + ||general.jump_limit.is_some() + ||general.booster.is_some() + ||general.zone.is_some() + ||general.stage_element.is_some() + ||general.wormhole.is_some() + ||intersecting.water.is_some() + ||intersecting.accelerator.is_some() + { + crate::model::CollisionAttributes::Intersect{intersecting,general} + }else{ + crate::model::CollisionAttributes::Decoration }, - false=>return crate::model::CollisionAttributes::Decoration, } } @@ -219,6 +231,7 @@ pub fn generate_indexed_models(dom:rbx_dom_weak::WeakDom) -> crate::model::Index ); //push TempIndexedAttributes + let mut force_intersecting=false; let mut temp_indexing_attributes=Vec::new(); if let Some(attr)=match &object.name[..]{ "MapStart"=>{ @@ -240,6 +253,7 @@ pub fn generate_indexed_models(dom:rbx_dom_weak::WeakDom) -> crate::model::Index } } }{ + force_intersecting=true; temp_indexing_attributes.push(attr); } @@ -440,7 +454,7 @@ pub fn generate_indexed_models(dom:rbx_dom_weak::WeakDom) -> crate::model::Index indexed_models[model_id].instances.push(crate::model::ModelInstance { transform:model_transform, color:glam::vec4(color3.r as f32/255f32, color3.g as f32/255f32, color3.b as f32/255f32, 1.0-*transparency), - attributes:get_attributes(&object.name,*can_collide,glam::vec3(velocity.x,velocity.y,velocity.z)), + attributes:get_attributes(&object.name,*can_collide,glam::vec3(velocity.x,velocity.y,velocity.z),force_intersecting), temp_indexing:temp_indexing_attributes, }); }