Skip to content

Commit 0401429

Browse files
authored
Merge pull request #1124 from Happypig375/patch-17
Fix 2D raycast to convert between physics engine values and pixel values
2 parents 938a0af + b6e1a7c commit 0401429

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Nu/Nu/Physics/PhysicsEngine2d.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ and [<ReferenceEquality>] PhysicsEngine2d =
750750
match fixture.Tag with
751751
| :? BodyShapeIndex as bodyShapeIndex ->
752752
if (int fixture.CollidesWith &&& collisionMask) <> 0 then
753-
let report = BodyIntersection.make bodyShapeIndex fraction (v3 point.X point.Y 0.0f) (v3 normal.X normal.Y 0.0f)
753+
let report = BodyIntersection.make bodyShapeIndex fraction (PhysicsEngine2d.toPixelV3 point) (v3 normal.X normal.Y 0.0f)
754754
if fraction < fractionMin then
755755
fractionMin <- fraction
756756
closestOpt <- Some report
@@ -759,8 +759,8 @@ and [<ReferenceEquality>] PhysicsEngine2d =
759759
if closestOnly then fraction else 1.0f)
760760
physicsEngine.PhysicsContext.RayCast
761761
(callback,
762-
Common.Vector2 (ray.Origin.X, ray.Origin.Y),
763-
Common.Vector2 (ray.Origin.X + ray.Direction.X, ray.Origin.Y + ray.Direction.Y))
762+
PhysicsEngine2d.toPhysicsV2 ray.Origin,
763+
PhysicsEngine2d.toPhysicsV2 (ray.Origin + ray.Direction))
764764
if closestOnly then
765765
match closestOpt with
766766
| Some closest -> [|closest|]

0 commit comments

Comments
 (0)