blender/source/gameengine/Ketsji/KX_BulletPhysicsController.h
Benoit Bolsee 15c105c157 BGE patch: Add damping and clamping option to motion actuator.
This patch introduces two options for the motion actuator:

damping: number of frames to reach the target velocity. It takes
into account the startup velocityin the target velocity direction
and add 1/damping fraction of target velocity until the full 
velocity is reached. Works only with linear and angular velocity.
It will be extended to delta and force motion method in a future
release.

clamping: apply the force and torque as long as the target velocity
is not reached. If this option is set, the velocity specified 
in linV or angV are not applied to the object but used as target
velocity. You should also specify a force in force or torque field: 
the force will be applied as long as the velocity along the axis of
the vector set in linV or angV is not reached. Works best in low
friction environment.
2008-06-24 19:37:43 +00:00

72 lines
2.1 KiB
C++

#ifndef KX_BULLET2PHYSICS_CONTROLLER
#define KX_BULLET2PHYSICS_CONTROLLER
#include "KX_IPhysicsController.h"
#include "CcdPhysicsController.h"
class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController
{
public:
KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna);
virtual ~KX_BulletPhysicsController ();
///////////////////////////////////
// KX_IPhysicsController interface
////////////////////////////////////
virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse);
virtual void SetObject (SG_IObject* object);
virtual void setMargin (float collisionMargin);
virtual void RelativeTranslate(const MT_Vector3& dloc,bool local);
virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local);
virtual void ApplyTorque(const MT_Vector3& torque,bool local);
virtual void ApplyForce(const MT_Vector3& force,bool local);
virtual MT_Vector3 GetLinearVelocity();
virtual MT_Vector3 GetAngularVelocity();
virtual MT_Vector3 GetVelocity(const MT_Point3& pos);
virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local);
virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local);
virtual void getOrientation(MT_Quaternion& orn);
virtual void setOrientation(const MT_Quaternion& orn);
virtual void setPosition(const MT_Point3& pos);
virtual void setScaling(const MT_Vector3& scaling);
virtual MT_Scalar GetMass();
virtual MT_Vector3 getReactionForce();
virtual void setRigidBody(bool rigid);
virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ);
virtual void SuspendDynamics();
virtual void RestoreDynamics();
virtual SG_Controller* GetReplica(class SG_Node* destnode);
void SetDyna(bool isDynamic) {
m_bDyna = isDynamic;
}
virtual void SetSumoTransform(bool nondynaonly);
// todo: remove next line !
virtual void SetSimulatedTime(double time);
// call from scene graph to update
virtual bool Update(double time);
void* GetUserData() { return m_userdata;}
void
SetOption(
int option,
int value
){
// intentionally empty
};
};
#endif //KX_BULLET2PHYSICS_CONTROLLER