wip accel code
This commit is contained in:
parent
3f62b9b353
commit
1c45e9a821
@ -228,6 +228,16 @@ pub struct WalkSettings{
|
||||
surf_dot:Planar64,//surf_dot<n.dot(up)/n.length()
|
||||
}
|
||||
impl WalkSettings{
|
||||
pub fn accel(&self,target_diff:Planar64Vec3,gravity:Planar64Vec3)->Planar64{
|
||||
//TODO: fallible walk accel
|
||||
let diff_len=target_diff.length();
|
||||
let friction=if diff_len<self.accelerate.topspeed{
|
||||
self.static_friction
|
||||
}else{
|
||||
self.kinetic_friction
|
||||
};
|
||||
self.accelerate.accel.min(-Planar64Vec3::Y.dot(gravity)*friction)
|
||||
}
|
||||
pub fn get_walk_target_velocity(&self,control_dir:Planar64Vec3,normal:Planar64Vec3)->Planar64Vec3{
|
||||
if control_dir==Planar64Vec3::ZERO{
|
||||
return control_dir;
|
||||
@ -263,6 +273,10 @@ pub struct LadderSettings{
|
||||
dot:Planar64,
|
||||
}
|
||||
impl LadderSettings{
|
||||
pub fn accel(&self,target_diff:Planar64Vec3,gravity:Planar64Vec3)->Planar64{
|
||||
//TODO: fallible ladder accel
|
||||
self.accelerate.accel
|
||||
}
|
||||
pub fn get_ladder_target_velocity(&self,mut control_dir:Planar64Vec3,normal:Planar64Vec3)->Planar64Vec3{
|
||||
if control_dir==Planar64Vec3::ZERO{
|
||||
return control_dir;
|
||||
|
Loading…
Reference in New Issue
Block a user