ApplyEffect is now easier to handle for the user
Only needs a function with a pointer to an ICustomBody now.
This commit is contained in:
parent
5c85580ffd
commit
0cae6261e9
|
@ -134,7 +134,7 @@ void Octree::Visit(const Oyster::Collision3D::ICollideable& collideable, Visitor
|
|||
{
|
||||
if(collideable.Intersects(this->leafData[i].container))
|
||||
{
|
||||
hitAction(*this, i);
|
||||
hitAction( this->GetCustomBody(i) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Oyster
|
|||
static const unsigned int invalid_ref;
|
||||
|
||||
typedef void(*VisitorAction)(Octree&, unsigned int, unsigned int);
|
||||
typedef void(*VisitorActionCollideable)(Octree&, unsigned int);
|
||||
typedef void(*VisitorActionCollideable)(ICustomBody*);
|
||||
|
||||
struct Data
|
||||
{
|
||||
|
|
|
@ -268,7 +268,7 @@ void API_Impl::RemoveGravity( const API::Gravity &g )
|
|||
}
|
||||
}
|
||||
|
||||
void API_Impl::ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(Octree&, unsigned int) )
|
||||
void API_Impl::ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(ICustomBody*) )
|
||||
{
|
||||
this->worldScene.Visit(collideable, hitAction);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Oyster
|
|||
void AddGravity( const API::Gravity &g );
|
||||
void RemoveGravity( const API::Gravity &g );
|
||||
|
||||
void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(Octree&, unsigned int) );
|
||||
void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(ICustomBody*) );
|
||||
|
||||
//void ApplyForceAt( const ICustomBody* objRef, const ::Oyster::Math::Float3 &worldPos, const ::Oyster::Math::Float3 &worldF );
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ namespace Oyster
|
|||
{
|
||||
class API;
|
||||
class ICustomBody;
|
||||
class Octree;
|
||||
|
||||
namespace Struct
|
||||
{
|
||||
|
@ -137,7 +136,12 @@ namespace Oyster
|
|||
********************************************************/
|
||||
virtual void RemoveGravity( const API::Gravity &g ) = 0;
|
||||
|
||||
virtual void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(Octree&, unsigned int) ) = 0;
|
||||
/********************************************************
|
||||
* Applies an effect to objects that collide with the set volume.
|
||||
* @param collideable: An ICollideable that defines the volume of the effect.
|
||||
* @param hitAction: A function that contains the effect.
|
||||
********************************************************/
|
||||
virtual void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(ICustomBody*) ) = 0;
|
||||
|
||||
///********************************************************
|
||||
// * Apply force on an object.
|
||||
|
|
Loading…
Reference in New Issue