Cornell Cocos
Cornell Extensions to Cocos2d
Public Member Functions | Public Attributes | List of all members
RaycastProxy Class Reference
Inheritance diagram for RaycastProxy:

Public Member Functions

 RaycastProxy ()
 
float32 ReportFixture (b2Fixture *fixture, const b2Vec2 &point, const b2Vec2 &normal, float32 fraction) override
 

Public Attributes

std::function< float(b2Fixture *fixture, const Vec2 &point, const Vec2 &normal, float fraction)> onQuery
 

Detailed Description

A lightweight b2RayCastCallback proxy.

This class allows us to replace the listener class with a modern closure.

Constructor & Destructor Documentation

RaycastProxy::RaycastProxy ( )
inline

Creates a new raycast proxy

Member Function Documentation

float32 RaycastProxy::ReportFixture ( b2Fixture *  fixture,
const b2Vec2 &  point,
const b2Vec2 &  normal,
float32  fraction 
)
inlineoverride

Called for each fixture found in the query.

This callback controls how the ray cast proceeds by returning a float. If -1, it ignores this fixture and continues. If 0, it terminates the ray cast. If 1, it does not clip the ray and continues. Finally, for any fraction, it clips the ray at that point.

Parameters
fixturethe fixture hit by the ray
pointthe point of initial intersection
normalthe normal vector at the point of intersection
factionthe fraction to return
Returns
-1 to filter, 0 to terminate, fraction to clip the ray, 1 to continue

Member Data Documentation

std::function<float(b2Fixture* fixture, const Vec2& point, const Vec2& normal, float fraction)> RaycastProxy::onQuery

Called for each fixture found in the query.

This callback controls how the ray cast proceeds by returning a float. If -1, it ignores this fixture and continues. If 0, it terminates the ray cast. If 1, it does not clip the ray and continues. Finally, for any fraction, it clips the ray at that point.

Parameters
fixturethe fixture hit by the ray
pointthe point of initial intersection
normalthe normal vector at the point of intersection
factionthe fraction to return
Returns
-1 to filter, 0 to terminate, fraction to clip the ray, 1 to continue

The documentation for this class was generated from the following file: