diff --git a/Code/OysterPhysics3D/OysterCollision3D.cpp b/Code/OysterPhysics3D/OysterCollision3D.cpp index 2f63fabb..a5d4117c 100644 --- a/Code/OysterPhysics3D/OysterCollision3D.cpp +++ b/Code/OysterPhysics3D/OysterCollision3D.cpp @@ -348,7 +348,7 @@ namespace Oyster { namespace Collision3D { namespace Utility bool Intersect( const Sphere &sphereA, const Sphere &sphereB, const ::Oyster::Math::Float3& worldPointOfContact ) { - //Ray sphereRay(sphereA, Float3(sphereB.center-sphereA.center).Normalize()); + Ray sphereRay(sphereA.center, Float3(sphereB.center-sphereA.center).Normalize()); return false; diff --git a/Code/OysterPhysics3D/OysterCollision3D.h b/Code/OysterPhysics3D/OysterCollision3D.h index 2b1f820f..7920a885 100644 --- a/Code/OysterPhysics3D/OysterCollision3D.h +++ b/Code/OysterPhysics3D/OysterCollision3D.h @@ -25,28 +25,28 @@ namespace Oyster { namespace Collision3D { namespace Utility void Compare( ::Oyster::Math::Float &connectOffset, const Plane &plane, const Point &point ); bool Intersect( const Point &pointA, const Point &pointB ); - bool Intersect( const Point &pointA, const Point &pointB, const ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Point &pointA, const Point &pointB, ::Oyster::Math::Float3& worldPointOfContact ); bool Intersect( const Ray &ray, const Point &point, ::Oyster::Math::Float &connectDistance ); bool Intersect( const Ray &rayA, const Ray &rayB, ::Oyster::Math::Float &connectDistanceA, ::Oyster::Math::Float &connectDistanceB ); - bool Intersect( const Ray &ray, const Point &point, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact ); - bool Intersect( const Ray &rayA, const Ray &rayB, ::Oyster::Math::Float &connectDistanceA, ::Oyster::Math::Float &connectDistanceB, const ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Ray &ray, const Point &point, ::Oyster::Math::Float &connectDistance, ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Ray &rayA, const Ray &rayB, ::Oyster::Math::Float &connectDistanceA, ::Oyster::Math::Float &connectDistanceB, ::Oyster::Math::Float3& worldPointOfContact ); bool Intersect( const Sphere &sphere, const Point &point ); bool Intersect( const Sphere &sphere, const Ray &ray, ::Oyster::Math::Float &connectDistance ); bool Intersect( const Sphere &sphereA, const Sphere &sphereB ); - bool Intersect( const Sphere &sphere, const Point &point, const ::Oyster::Math::Float3& worldPointOfContact ); - bool Intersect( const Sphere &sphere, const Ray &ray, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact ); - bool Intersect( const Sphere &sphereA, const Sphere &sphereB, const ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Sphere &sphere, const Point &point, ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Sphere &sphere, const Ray &ray, ::Oyster::Math::Float &connectDistance, ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Sphere &sphereA, const Sphere &sphereB, ::Oyster::Math::Float3& worldPointOfContact ); bool Intersect( const Plane &plane, const Point &point ); bool Intersect( const Plane &plane, const Ray &ray, ::Oyster::Math::Float &connectDistance ); bool Intersect( const Plane &plane, const Sphere &sphere ); bool Intersect( const Plane &planeA, const Plane &planeB ); - bool Intersect( const Plane &plane, const Point &point, const ::Oyster::Math::Float3& worldPointOfContact ); - bool Intersect( const Plane &plane, const Ray &ray, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact ); - bool Intersect( const Plane &plane, const Sphere &sphere, const ::Oyster::Math::Float3& worldPointOfContact ); - bool Intersect( const Plane &planeA, const Plane &planeB, const ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Plane &plane, const Point &point, ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Plane &plane, const Ray &ray, ::Oyster::Math::Float &connectDistance, ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Plane &plane, const Sphere &sphere, ::Oyster::Math::Float3& worldPointOfContact ); + bool Intersect( const Plane &planeA, const Plane &planeB, ::Oyster::Math::Float3& worldPointOfContact ); // bool Intersect( const Triangle &triangle, const Point &point, ? ); // bool Intersect( const Triangle &triangle, const Ray &ray, ? ); diff --git a/Code/OysterPhysics3D/Plane.cpp b/Code/OysterPhysics3D/Plane.cpp index 0bc14982..87d20c84 100644 --- a/Code/OysterPhysics3D/Plane.cpp +++ b/Code/OysterPhysics3D/Plane.cpp @@ -50,7 +50,7 @@ bool Plane::Intersects( const ICollideable &target ) const } } -bool Plane::Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const +bool Plane::Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldPointOfContact ) const { switch( target.type ) { diff --git a/Code/OysterPhysics3D/Plane.h b/Code/OysterPhysics3D/Plane.h index e38240f3..35b68261 100644 --- a/Code/OysterPhysics3D/Plane.h +++ b/Code/OysterPhysics3D/Plane.h @@ -29,7 +29,7 @@ namespace Oyster { namespace Collision3D virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable &target ) const; - bool Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const; + bool Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldPointOfContact ) const; bool Contains( const ICollideable &target ) const; }; } } diff --git a/Code/OysterPhysics3D/Point.cpp b/Code/OysterPhysics3D/Point.cpp index 7bcce9ae..717b47a4 100644 --- a/Code/OysterPhysics3D/Point.cpp +++ b/Code/OysterPhysics3D/Point.cpp @@ -48,14 +48,14 @@ bool Point::Intersects( const ICollideable &target ) const } } -bool Point::Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const +bool Point::Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldPointOfContact ) const { switch( target.type ) { case Type_universe: return true; case Type_point: return Utility::Intersect( *this, *(Point*)&target, worldPointOfContact ); - case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance, worldPointOfContact ); - case Type_sphere: return Utility::Intersect( *this, *(Sphere*)&target, worldPointOfContact ); + case Type_ray: return Utility::Intersect( *(Ray*)&target, *this, ((Ray*)&target)->collisionDistance, worldPointOfContact ); + case Type_sphere: return Utility::Intersect( *(Sphere*)&target, *this, worldPointOfContact ); case Type_plane: return Utility::Intersect( *(Plane*)&target, *this, worldPointOfContact ); // case Type_triangle: return false; // TODO: case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this, worldPointOfContact ); diff --git a/Code/OysterPhysics3D/Point.h b/Code/OysterPhysics3D/Point.h index 60b74659..ca6f4082 100644 --- a/Code/OysterPhysics3D/Point.h +++ b/Code/OysterPhysics3D/Point.h @@ -28,7 +28,7 @@ namespace Oyster { namespace Collision3D virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable &target ) const; - bool Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const; + bool Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldPointOfContact ) const; bool Contains( const ICollideable &target ) const; }; } } diff --git a/Code/OysterPhysics3D/Ray.cpp b/Code/OysterPhysics3D/Ray.cpp index 2a640163..d1e81974 100644 --- a/Code/OysterPhysics3D/Ray.cpp +++ b/Code/OysterPhysics3D/Ray.cpp @@ -55,20 +55,20 @@ bool Ray::Intersects( const ICollideable &target ) const } } -bool Ray::Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const +bool Ray::Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldPointOfContact ) const { switch( target.type ) { case Type_universe: this->collisionDistance = 0.0f; return true; - case Type_point: return Utility::Intersect( *this, *(Point*)&target, worldPointOfContact ); - case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance, worldPointOfContact ); - case Type_sphere: return Utility::Intersect( *this, *(Sphere*)&target, worldPointOfContact ); - case Type_plane: return Utility::Intersect( *(Plane*)&target, *this, worldPointOfContact ); + case Type_point: return Utility::Intersect( *this, *(Point*)&target, this->collisionDistance, worldPointOfContact ); + case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, this->collisionDistance, ((Ray*)&target)->collisionDistance, worldPointOfContact ); + case Type_sphere: return Utility::Intersect( *(Sphere*)&target, *this, this->collisionDistance, worldPointOfContact ); + case Type_plane: return Utility::Intersect( *(Plane*)&target, *this, this->collisionDistance, worldPointOfContact ); // case Type_triangle: return false; // TODO: - case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this, worldPointOfContact ); - case Type_box: return Utility::Intersect( *(Box*)&target, *this, worldPointOfContact ); + case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this, this->collisionDistance, worldPointOfContact ); + case Type_box: return Utility::Intersect( *(Box*)&target, *this, this->collisionDistance, worldPointOfContact ); case Type_frustrum: return false; // TODO: default: worldPointOfContact = NULL; return false; diff --git a/Code/OysterPhysics3D/Ray.h b/Code/OysterPhysics3D/Ray.h index 34f32ebe..52131af3 100644 --- a/Code/OysterPhysics3D/Ray.h +++ b/Code/OysterPhysics3D/Ray.h @@ -37,7 +37,7 @@ namespace Oyster { namespace Collision3D virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable &target ) const; - bool Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const; + bool Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldPointOfContact ) const; bool Contains( const ICollideable &target ) const; }; } } diff --git a/Code/OysterPhysics3D/Sphere.cpp b/Code/OysterPhysics3D/Sphere.cpp index eb907e59..399fd0be 100644 --- a/Code/OysterPhysics3D/Sphere.cpp +++ b/Code/OysterPhysics3D/Sphere.cpp @@ -45,7 +45,7 @@ bool Sphere::Intersects( const ICollideable &target ) const } } -bool Sphere::Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const +bool Sphere::Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldPointOfContact ) const { switch( target.type ) { diff --git a/Code/OysterPhysics3D/Sphere.h b/Code/OysterPhysics3D/Sphere.h index 0c4b8094..e2719328 100644 --- a/Code/OysterPhysics3D/Sphere.h +++ b/Code/OysterPhysics3D/Sphere.h @@ -28,7 +28,7 @@ namespace Oyster { namespace Collision3D virtual ::Utility::DynamicMemory::UniquePointer Clone( ) const; bool Intersects( const ICollideable &target ) const; - bool Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const; + bool Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldPointOfContact ) const; bool Contains( const ICollideable &target ) const; }; } }