* Update * Add: [Get/Set]AngularDaming for standardization * Fix: Name error * Add: [Get/Set][AngularDamping/MomentOfInertia] in PhysicsComponent2D * Forgot in last commit * Add: param coordSys in [PhysicsComponent2D/RigidBody2D]::SetMassCenter * Add: Some forgotten inline * Fix little error * Fix: Indentation before case * Move and Change GetCenterOfGravity * Rename m_world into m_physWorld * Rename GetWorld int GetPhysWorld * Update: PhysicsSystem2D became an interface of PhysWorld2D * Update Collison/PhysicsComponent because GetWorld was renamed * Update tests * Update: Make the interface usable with Entity instead of PhysicsComponent * Update: Make GetPhysWorld private * Update PhysicsSystem2D.hpp * Update: indent * Remove: useless blank line * update order(?) * Update PhysicsSystem2D.hpp * Add calls to GetPhysWorld to attempt a nullptr value * update include * little fix * add some missing inline * Fix * Make all component inherits of HandledObject * fix: compilation error * Add Handle alias for all Components * forgot in last commit
59 lines
1.6 KiB
C++
59 lines
1.6 KiB
C++
// Copyright (C) 2017 Jérôme Leclercq
|
|
// This file is part of the "Nazara Development Kit"
|
|
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
|
|
|
#pragma once
|
|
|
|
#ifndef NDK_COMPONENTS_COLLISIONCOMPONENT3D_HPP
|
|
#define NDK_COMPONENTS_COLLISIONCOMPONENT3D_HPP
|
|
|
|
#include <Nazara/Physics3D/Collider3D.hpp>
|
|
#include <Nazara/Physics3D/RigidBody3D.hpp>
|
|
#include <NDK/Component.hpp>
|
|
#include <memory>
|
|
|
|
namespace Ndk
|
|
{
|
|
class CollisionComponent3D;
|
|
|
|
using CollisionComponent3DHandle = Nz::ObjectHandle<CollisionComponent3D>;
|
|
|
|
class NDK_API CollisionComponent3D : public Component<CollisionComponent3D>
|
|
{
|
|
friend class PhysicsSystem3D;
|
|
|
|
public:
|
|
CollisionComponent3D(Nz::Collider3DRef geom = Nz::Collider3DRef());
|
|
CollisionComponent3D(const CollisionComponent3D& collision);
|
|
~CollisionComponent3D() = default;
|
|
|
|
const Nz::Collider3DRef& GetGeom() const;
|
|
|
|
void SetGeom(Nz::Collider3DRef geom);
|
|
|
|
CollisionComponent3D& operator=(Nz::Collider3DRef geom);
|
|
CollisionComponent3D& operator=(CollisionComponent3D&& collision) = default;
|
|
|
|
static ComponentIndex componentIndex;
|
|
|
|
private:
|
|
void InitializeStaticBody();
|
|
Nz::RigidBody3D* GetStaticBody();
|
|
|
|
void OnAttached() override;
|
|
void OnComponentAttached(BaseComponent& component) override;
|
|
void OnComponentDetached(BaseComponent& component) override;
|
|
void OnDetached() override;
|
|
void OnEntityDisabled() override;
|
|
void OnEntityEnabled() override;
|
|
|
|
std::unique_ptr<Nz::RigidBody3D> m_staticBody;
|
|
Nz::Collider3DRef m_geom;
|
|
bool m_bodyUpdated;
|
|
};
|
|
}
|
|
|
|
#include <NDK/Components/CollisionComponent3D.inl>
|
|
|
|
#endif // NDK_COMPONENTS_COLLISIONCOMPONENT3D_HPP
|