mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-09 17:08:06 +00:00
Use better API terminology for radii
- SetProximityRadius just calls AddProximityRadius so its clear what is going on. - created struct BoxDimensions for clear reading of what the floats are
This commit is contained in:
@@ -18,7 +18,7 @@ dpEntity::dpEntity(const LWOOBJID& objectID, dpShapeType shapeType, bool isStati
|
||||
break;
|
||||
|
||||
case dpShapeType::Box:
|
||||
m_CollisionShape = new dpShapeBox(this, 1.0f, 1.0f, 1.0f);
|
||||
m_CollisionShape = new dpShapeBox(this, BoxDimensions(1.0f, 1.0f, 1.0f));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -26,14 +26,14 @@ dpEntity::dpEntity(const LWOOBJID& objectID, dpShapeType shapeType, bool isStati
|
||||
}
|
||||
}
|
||||
|
||||
dpEntity::dpEntity(const LWOOBJID& objectID, NiPoint3 boxDimensions, bool isStatic) {
|
||||
dpEntity::dpEntity(const LWOOBJID& objectID, const BoxDimensions& boxDimensions, bool isStatic) {
|
||||
m_ObjectID = objectID;
|
||||
m_IsStatic = isStatic;
|
||||
m_CollisionShape = nullptr;
|
||||
m_Scale = 1.0f;
|
||||
m_CollisionGroup = COLLISION_GROUP_ALL;
|
||||
|
||||
m_CollisionShape = new dpShapeBox(this, boxDimensions.x, boxDimensions.y, boxDimensions.z);
|
||||
m_CollisionShape = new dpShapeBox(this, boxDimensions);
|
||||
}
|
||||
|
||||
dpEntity::dpEntity(const LWOOBJID& objectID, float width, float height, float depth, bool isStatic) {
|
||||
@@ -43,7 +43,7 @@ dpEntity::dpEntity(const LWOOBJID& objectID, float width, float height, float de
|
||||
m_Scale = 1.0f;
|
||||
m_CollisionGroup = COLLISION_GROUP_ALL;
|
||||
|
||||
m_CollisionShape = new dpShapeBox(this, width, height, depth);
|
||||
m_CollisionShape = new dpShapeBox(this, BoxDimensions(width, height, depth));
|
||||
}
|
||||
|
||||
dpEntity::dpEntity(const LWOOBJID& objectID, float radius, bool isStatic) {
|
||||
|
@@ -10,12 +10,14 @@
|
||||
#include "dpCollisionGroups.h"
|
||||
#include "dpGrid.h"
|
||||
|
||||
class BoxDimensions;
|
||||
|
||||
class dpEntity {
|
||||
friend class dpGrid; //using friend here for now so grid can access everything
|
||||
|
||||
public:
|
||||
dpEntity(const LWOOBJID& objectID, dpShapeType shapeType, bool isStatic = true);
|
||||
dpEntity(const LWOOBJID& objectID, NiPoint3 boxDimensions, bool isStatic = true);
|
||||
dpEntity(const LWOOBJID& objectID, const BoxDimensions& boxDimensions, bool isStatic = true);
|
||||
dpEntity(const LWOOBJID& objectID, float width, float height, float depth, bool isStatic = true);
|
||||
dpEntity(const LWOOBJID& objectID, float radius, bool isStatic = true);
|
||||
|
||||
|
@@ -9,11 +9,11 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
dpShapeBox::dpShapeBox(dpEntity* parentEntity, float width, float height, float depth) :
|
||||
dpShapeBox::dpShapeBox(dpEntity* parentEntity, const BoxDimensions& dimensions) :
|
||||
dpShapeBase(parentEntity),
|
||||
m_Width(width / 2),
|
||||
m_Height(height / 2),
|
||||
m_Depth(depth / 2),
|
||||
m_Width(dimensions.width / 2),
|
||||
m_Height(dimensions.height / 2),
|
||||
m_Depth(dimensions.depth / 2),
|
||||
m_Scale(1.0f) {
|
||||
m_ShapeType = dpShapeType::Box;
|
||||
|
||||
|
@@ -4,9 +4,16 @@
|
||||
#include "NiPoint3.h"
|
||||
#include "NiQuaternion.h"
|
||||
|
||||
struct BoxDimensions {
|
||||
BoxDimensions(float width, float height, float depth) : width(width), height(height), depth(depth) { }
|
||||
float width;
|
||||
float height;
|
||||
float depth;
|
||||
};
|
||||
|
||||
class dpShapeBox : public dpShapeBase {
|
||||
public:
|
||||
dpShapeBox(dpEntity* parentEntity, float width, float height, float depth);
|
||||
dpShapeBox(dpEntity* parentEntity, const BoxDimensions& dimensions);
|
||||
~dpShapeBox();
|
||||
|
||||
bool IsColliding(dpShapeBase* other);
|
||||
|
Reference in New Issue
Block a user