#ifndef __C_SCENE_NODE_ANIMATOR_COLLISION_RESPONSE_H_INCLUDED__
#define __C_SCENE_NODE_ANIMATOR_COLLISION_RESPONSE_H_INCLUDED__
#include "ISceneNodeAnimatorCollisionResponse.h"
namespace irr
{
namespace scene
{
class CSceneNodeAnimatorCollisionResponse : public ISceneNodeAnimatorCollisionResponse
{
public:
CSceneNodeAnimatorCollisionResponse(ISceneManager* scenemanager,
ITriangleSelector* world, ISceneNode* object,
const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30),
const core::vector3df& gravityPerSecond = core::vector3df(0,-100.0f,0),
const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0),
f32 slidingSpeed = 0.0005f);
virtual ~CSceneNodeAnimatorCollisionResponse();
virtual bool isFalling() const;
virtual void setEllipsoidRadius(const core::vector3df& radius);
virtual core::vector3df getEllipsoidRadius() const;
virtual void setGravity(const core::vector3df& gravity);
virtual void jump(f32 jumpSpeed);
virtual void setAnimateTarget ( bool enable );
virtual bool getAnimateTarget () const;
virtual core::vector3df getGravity() const;
virtual void setEllipsoidTranslation(const core::vector3df &translation);
virtual core::vector3df getEllipsoidTranslation() const;
virtual void setWorld(ITriangleSelector* newWorld);
virtual ITriangleSelector* getWorld() const;
virtual void animateNode(ISceneNode* node, u32 timeMs);
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_COLLISION_RESPONSE; }
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
virtual void setTargetNode(ISceneNode * node) { setNode(node); }
virtual ISceneNode* getTargetNode(void) const { return Object; }
virtual bool collisionOccurred() const { return CollisionOccurred; }
virtual const core::vector3df & getCollisionPoint() const { return CollisionPoint; }
virtual const core::triangle3df & getCollisionTriangle() const { return CollisionTriangle; }
virtual const core::vector3df & getCollisionResultPosition(void) const { return CollisionResultPosition; }
virtual ISceneNode* getCollisionNode(void) const { return CollisionNode; }
virtual void setCollisionCallback(ICollisionCallback* callback);
private:
void setNode(ISceneNode* node);
core::vector3df Radius;
core::vector3df Gravity;
core::vector3df Translation;
core::vector3df FallingVelocity;
core::vector3df LastPosition;
core::triangle3df RefTriangle;
ITriangleSelector* World;
ISceneNode* Object;
ISceneManager* SceneManager;
u32 LastTime;
f32 SlidingSpeed;
core::vector3df CollisionPoint;
core::triangle3df CollisionTriangle;
core::vector3df CollisionResultPosition;
ISceneNode * CollisionNode;
ICollisionCallback* CollisionCallback;
bool Falling;
bool IsCamera;
bool AnimateCameraTarget;
bool CollisionOccurred;
bool FirstUpdate;
};
}
}
#endif