28 _moveSpeed(Metric::Base(1.0f)),
29 _acceleration(Metric::Base(1.0f)),
55 const D64 timeDif = Time::MicrosecondsToSeconds<D64>( deltaTimeUS );
73 if (!yTolerance && !
IS_ZERO(yDelta)) {
78 if (!xTolerance || !zTolerance) {
90 }
else if (std::fabs(xDelta) > std::fabs(zDelta)) {
91 F32 value = std::fabs(zDelta / xDelta) * moveDistance;
100 F32 value = std::fabs(xDelta / zDelta) * moveDistance;
202 const AttributeMap::const_iterator it =
_attributes.find(attributeID);
FORCE_INLINE T * get() const
Returns a pointer to a specific component. Returns null if the SGN does not have the component reques...
F32 _moveSpeed
Movement speed (meters per second)
virtual bool teleportTo(const vec3< F32 > &targetPosition)
teleportTo instantly places the unit at the desired position
virtual void setAttribute(U32 attributeID, I32 initialValue)
vec3< F32 > _currentPosition
Unit position in world.
virtual bool moveToZ(F32 targetPosition, const U64 deltaTimeUS)
Move along the Z axis.
SharedMutex _unitUpdateMutex
virtual bool moveTo(const vec3< F32 > &targetPosition, const U64 deltaTimeUS)
virtual void setParentNode(SceneGraphNode *node)
F32 _moveTolerance
acceptable distance from target
virtual bool moveToX(F32 targetPosition, const U64 deltaTimeUS)
Move along the X axis.
virtual I32 getAttribute(U32 attributeID) const
virtual bool moveToY(F32 targetPosition, const U64 deltaTimeUS)
Move along the Y axis.
vec3< F32 > _currentTargetPosition
Current destination point cached.
bool compare(const vec3< U > &v) const noexcept
compare 2 vectors
constexpr T Centi(T a)
Base value * 0.01.
static const char * unitType[]
const char * UnitTypeToString(UnitType unitType) noexcept
UnitType StringToUnitType(const string &name)
Handle console commands that start with a forward slash.
std::lock_guard< mutex > LockGuard
bool IS_ZERO(const T X) noexcept
constexpr F32 to_F32(const T value)
UnitType
Currently supported unit types.
@ COUNT
add more types above this
bool IS_TOLERANCE(const T X, const T TOLERANCE) noexcept
constexpr U8 to_U8(const T value)
constexpr auto to_base(const Type value) -> Type