Make dashback configurable, fix movement bugs, add double jump forward and back.
This commit is contained in:
@@ -141,6 +141,15 @@ impl FGSegment2d {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a value representing the normalized position along the segment.
|
||||
pub fn project_point_normalized(&self, point: FGVec2) -> FGi32 {
|
||||
let segment_vector = self.point2 - self.point1;
|
||||
let offset = point - self.point1;
|
||||
// The signed projection of `offset` onto `segment_vector`, scaled by the length of the segment.
|
||||
let projection_scaled = segment_vector.dot(offset);
|
||||
FGi32::from_num(FGWide::from_num(projection_scaled) / segment_vector.length_squared())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user