forked from StrafesNET/strafe-client
named epsilon
This commit is contained in:
parent
1ef659e46a
commit
6ed5dd8028
@ -1,5 +1,7 @@
|
|||||||
use strafesnet_common::integer::{Planar64,Planar64Vec3};
|
use strafesnet_common::integer::{Planar64,Planar64Vec3};
|
||||||
|
|
||||||
|
const EPSILON:Planar64=Planar64::raw(1<<(32-10));
|
||||||
|
|
||||||
type Indices=arrayvec::ArrayVec<usize,4>;
|
type Indices=arrayvec::ArrayVec<usize,4>;
|
||||||
|
|
||||||
struct Ray{
|
struct Ray{
|
||||||
@ -51,7 +53,7 @@ const fn solve0()->Planar64Vec3{
|
|||||||
fn solve1(c0:&Contact)->Option<Planar64Vec3>{
|
fn solve1(c0:&Contact)->Option<Planar64Vec3>{
|
||||||
let d0=c0.normal.dot(c0.position);
|
let d0=c0.normal.dot(c0.position);
|
||||||
let det=c0.normal.dot(c0.velocity);
|
let det=c0.normal.dot(c0.velocity);
|
||||||
if det.get().abs()<0{
|
if det.abs()<EPSILON{
|
||||||
None
|
None
|
||||||
}else{
|
}else{
|
||||||
Some(c0.normal*d0/det)
|
Some(c0.normal*d0/det)
|
||||||
|
Loading…
Reference in New Issue
Block a user