cling thing

This commit is contained in:
Quaternions 2023-11-01 18:02:29 -07:00
parent 895f9b82f8
commit 6fec6b9f59
2 changed files with 2 additions and 0 deletions

View File

@ -90,6 +90,7 @@ pub struct ContactingLadder{
#[derive(Clone)] #[derive(Clone)]
pub enum ContactingBehaviour{ pub enum ContactingBehaviour{
Surf, Surf,
Cling,//usable as a zipline, or other weird and wonderful things
Ladder(ContactingLadder), Ladder(ContactingLadder),
Elastic(u32),//[1/2^32,1] 0=None (elasticity+1)/2^32 Elastic(u32),//[1/2^32,1] 0=None (elasticity+1)/2^32
} }

View File

@ -1108,6 +1108,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
let mut v=self.body.velocity; let mut v=self.body.velocity;
match &contacting.contact_behaviour{ match &contacting.contact_behaviour{
Some(crate::model::ContactingBehaviour::Surf)=>println!("I'm surfing!"), Some(crate::model::ContactingBehaviour::Surf)=>println!("I'm surfing!"),
Some(crate::model::ContactingBehaviour::Cling)=>println!("Unimplemented!"),
&Some(crate::model::ContactingBehaviour::Elastic(elasticity))=>{ &Some(crate::model::ContactingBehaviour::Elastic(elasticity))=>{
let n=c.normal(&self.models); let n=c.normal(&self.models);
let d=n.dot(v)*Planar64::raw(-1-elasticity as i64); let d=n.dot(v)*Planar64::raw(-1-elasticity as i64);