Skip to content

Sphere-cone intersection test fails #694

Description

@Leadwerks

If you use this code with a very wide angle cone it can fail when the camera gets near the apex.

Image

The problem is with this line of code:

/* Point - cone test */
if ((diff - sphereRadius * sinAngle * coneNormal).Dot(coneNormal) > 0.0f)
{

I don't understand the exact math here but that statement is causing some valid intersections to get discarded.

I worked around this by adding my own checks for when the camera is above or below the cone, or within the radius of the apex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions