Original Post
[color="#2a2a2a"]Can someone please help with the below. I only get a positive 'hit' when I am in the bounding box. Thanks for any help.
[color="#2a2a2a"]
[color="#2a2a2a"]Thanks guys !
[color="#2a2a2a"]
Public Function RayBBIntersects(ByVal bb As BoundingBox, ByVal xPos As Single, ByVal yPos As Single) As Boolean
Dim near As New Vector3(xPos, yPos, 0.0F)
Dim far As New Vector3(xPos, yPos, 1.0F)
Dim n As Vector3 = Vector3.Unproject(near, 0, 0, cClientArea.Width, cClientArea.Height, -1000, 1000, cViewMatrix * cProjectionMatrix)
Dim f As Vector3 = Vector3.Unproject(far, 0, 0, cClientArea.Width, cClientArea.Height, -1000, 1000, cViewMatrix * cProjectionMatrix)
Dim direction As Vector3 = f - n
direction.Normalize()
Dim r As New Ray(n, direction)
Dim distance As Single = 0
Return Ray.Intersects(r, bb, distance)
End Function[color="#2a2a2a"]Thanks guys !