2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CPHYSICSACTOR_HPP__
|
|
|
|
#define __URDE_CPHYSICSACTOR_HPP__
|
2015-08-22 01:58:41 +00:00
|
|
|
|
|
|
|
#include "CActor.hpp"
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-22 01:58:41 +00:00
|
|
|
{
|
2016-04-19 00:17:49 +00:00
|
|
|
struct SMoverData;
|
2015-08-22 01:58:41 +00:00
|
|
|
|
2015-11-02 18:45:39 +00:00
|
|
|
class CCollisionPrimitive
|
|
|
|
{
|
|
|
|
public:
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CVector3f x1d8_offset;
|
2015-11-02 18:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCollisionInfoList
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2016-04-19 00:17:49 +00:00
|
|
|
struct SMoverData
|
|
|
|
{
|
|
|
|
zeus::CVector3f x0_;
|
|
|
|
zeus::CAxisAngle xc_;
|
|
|
|
zeus::CVector3f x18_;
|
|
|
|
zeus::CAxisAngle x24_;
|
|
|
|
float x30_;
|
|
|
|
|
|
|
|
SMoverData(float a) : x30_(a) {}
|
|
|
|
};
|
|
|
|
|
2015-08-22 01:58:41 +00:00
|
|
|
class CPhysicsActor : public CActor
|
|
|
|
{
|
2015-11-02 18:45:39 +00:00
|
|
|
protected:
|
|
|
|
float xd8_mass;
|
|
|
|
float xdc_massRecip;
|
|
|
|
float xe0_inertialTensor;
|
|
|
|
float xe4_inertialTensorRecip;
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CAABox x194_baseBoundingBox;
|
2015-11-02 18:45:39 +00:00
|
|
|
CCollisionPrimitive x1b0_collisionPrimitive;
|
|
|
|
float x228_stepUpHeight;
|
|
|
|
float x22c_stepDownHeight;
|
|
|
|
float x230_restitutionCoefModifier;
|
|
|
|
float x234_collisionAccuracyModifier;
|
|
|
|
public:
|
2016-04-19 00:17:49 +00:00
|
|
|
CPhysicsActor(TUniqueId, bool, const std::string&, const CEntityInfo&,
|
|
|
|
const zeus::CTransform&, const CModelData&, const CMaterialList&,
|
|
|
|
const zeus::CAABox&, const SMoverData&, const CActorParameters&,
|
|
|
|
float, float);
|
2015-11-02 18:45:39 +00:00
|
|
|
|
|
|
|
float GetCollisionAccuracyModifier()
|
|
|
|
{ return x234_collisionAccuracyModifier; }
|
|
|
|
|
|
|
|
void SetCollisionAccuracyModifier(float modifier)
|
|
|
|
{ x234_collisionAccuracyModifier = modifier; }
|
|
|
|
|
|
|
|
float GetCoefficientOfRestitutionModifier()
|
|
|
|
{ return x230_restitutionCoefModifier; }
|
|
|
|
|
|
|
|
void SetCoefficientOfRestitutionModifier(float modifier)
|
|
|
|
{ x230_restitutionCoefModifier = modifier;}
|
|
|
|
|
|
|
|
void DrawCollisionPrimitive()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
void Render(const CStateManager&)
|
|
|
|
{}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CVector3f GetAimPosition(const CStateManager&, float val)
|
2015-11-02 18:45:39 +00:00
|
|
|
{
|
|
|
|
if (val <= 0.0)
|
|
|
|
return GetBoundingBox().center();
|
2016-03-04 23:04:53 +00:00
|
|
|
//zeus::CVector3f delta = PredictMotion(val);
|
|
|
|
return zeus::CVector3f();
|
2015-11-02 18:45:39 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CVector3f GetOrbitPosition(const CStateManager&)
|
2015-11-02 18:45:39 +00:00
|
|
|
{ return GetBoundingBox().center(); }
|
|
|
|
|
|
|
|
float GetStepUpHeight()
|
|
|
|
{ return x228_stepUpHeight; }
|
|
|
|
|
|
|
|
float GetStepDownHeight()
|
|
|
|
{ return x22c_stepDownHeight; }
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void SetPrimitiveOffset(const zeus::CVector2f& offset)
|
2015-11-02 18:45:39 +00:00
|
|
|
{ x1b0_collisionPrimitive.x1d8_offset = offset; }
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CVector3f GetPrimitiveOffset()
|
2015-11-02 18:45:39 +00:00
|
|
|
{ return x1b0_collisionPrimitive.x1d8_offset; }
|
|
|
|
|
|
|
|
float GetWeight()
|
|
|
|
{ return 24.525002f * xd8_mass; }
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void SetBoundingBox(const zeus::CAABox& box)
|
2015-11-02 18:45:39 +00:00
|
|
|
{ x194_baseBoundingBox = box; }
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CAABox GetMotionVolume()
|
|
|
|
{ return zeus::CAABox::skInvertedBox; }
|
2015-11-02 18:45:39 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CAABox GetBoundingBox()
|
|
|
|
{ return zeus::CAABox::skInvertedBox; }
|
2015-11-02 18:45:39 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const zeus::CAABox& GetBaseBoundingBox() const
|
2015-11-02 18:45:39 +00:00
|
|
|
{ return x194_baseBoundingBox; }
|
|
|
|
|
|
|
|
void CollidedWith(const TUniqueId&, const CCollisionInfoList&, CStateManager&)
|
|
|
|
{}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CTransform GetPrimitiveTransform()
|
2015-11-02 18:45:39 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
return zeus::CTransform();
|
2015-11-02 18:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const CCollisionPrimitive& GetCollisionPrimitive() const
|
|
|
|
{ return x1b0_collisionPrimitive; }
|
|
|
|
|
2015-11-02 18:50:24 +00:00
|
|
|
void SetInertiaTensorScalar(float tensor)
|
2015-11-02 18:45:39 +00:00
|
|
|
{
|
|
|
|
if (tensor <= 0.0f)
|
|
|
|
tensor = 1.0f;
|
|
|
|
xe0_inertialTensor = tensor;
|
|
|
|
xe4_inertialTensorRecip = 1.0f / tensor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetMass(float mass)
|
|
|
|
{
|
|
|
|
xd8_mass = mass;
|
|
|
|
float tensor = 1.0f;
|
|
|
|
if (mass > 0.0f)
|
|
|
|
tensor = 1.0f / mass;
|
|
|
|
|
|
|
|
xdc_massRecip = tensor;
|
2015-11-02 18:50:24 +00:00
|
|
|
SetInertiaTensorScalar(mass * tensor);
|
2015-11-02 18:45:39 +00:00
|
|
|
}
|
2015-08-22 01:58:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CPHYSICSACTOR_HPP__
|