1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-29 06:36:44 +00:00
openmw-tes3mp/apps/openmw/mwphysics/projectile.hpp
Andrei Kortunov dc7b48e92e Generate physics collisions for projectiles (bug #3372)
Remove redundant now mHit field
2020-12-08 09:05:38 +01:00

68 lines
1.3 KiB
C++

#ifndef OPENMW_MWPHYSICS_PROJECTILE_H
#define OPENMW_MWPHYSICS_PROJECTILE_H
#include <memory>
#include "ptrholder.hpp"
#include <osg/Vec3f>
#include <osg/Quat>
#include <osg/ref_ptr>
class btCollisionWorld;
class btCollisionShape;
class btCollisionObject;
class btConvexShape;
namespace Resource
{
class BulletShape;
}
namespace MWPhysics
{
class Projectile : public PtrHolder
{
public:
Projectile(const int projectileId, const osg::Vec3f& position, btCollisionWorld* world);
~Projectile();
btConvexShape* getConvexShape() const { return mConvexShape; }
void updateCollisionObjectPosition();
void setPosition(const osg::Vec3f& position);
osg::Vec3f getPosition() const;
btCollisionObject* getCollisionObject() const
{
return mCollisionObject.get();
}
int getProjectileId() const
{
return mProjectileId;
}
private:
std::unique_ptr<btCollisionShape> mShape;
btConvexShape* mConvexShape;
std::unique_ptr<btCollisionObject> mCollisionObject;
osg::Vec3f mPosition;
btCollisionWorld* mCollisionWorld;
Projectile(const Projectile&);
Projectile& operator=(const Projectile&);
int mProjectileId;
};
}
#endif