Skip to content

Commit

Permalink
Player can drop weapon
Browse files Browse the repository at this point in the history
  • Loading branch information
Benualdo committed Sep 29, 2024
1 parent 351abff commit a9c7410
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/engine/Component/Physics/Body/PhysicsBodyComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace vg::engine
void OnPropertyChanged (core::IObject * _object, const core::IProperty & _prop, bool _notifyParent) final override;
bool TryGetAABB (core::AABB & _aabb) const final override;

void SetMatrix (const core::float4x4 & _matrix) final override;
void AddImpulse (const core::float3 & _impulse) final override;

void onShapeUpdated ();
Expand Down
10 changes: 8 additions & 2 deletions src/engine/Component/Physics/Body/PhysicsBodyComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ namespace vg::engine
if (nullptr == m_bodyDesc)
return;

if (_context.m_world->IsPlaying() && !_context.m_world->IsPaused()) // TODO: use context?
if (_context.m_world->IsPlaying() && !_context.m_world->IsPaused())
{
if (m_body)
{
if (m_bodyDesc->IsTrigger())
{
m_body->SetMatrix(_context.m_gameObject->getGlobalMatrix());
SetMatrix(_context.m_gameObject->getGlobalMatrix());
}
else
{
Expand Down Expand Up @@ -343,4 +343,10 @@ namespace vg::engine
if (m_body)
m_body->AddImpulse(_impulse);
}

//--------------------------------------------------------------------------------------
void PhysicsBodyComponent::SetMatrix(const core::float4x4 & _matrix)
{
m_body->SetMatrix(_matrix);
}
}
1 change: 1 addition & 0 deletions src/engine/IPhysicsBodyComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace vg::engine
public:
VG_CLASS_DECL_ABSTRACT(IPhysicsBodyComponent, core::Component);

virtual void SetMatrix(const core::float4x4 & _matrix) = 0;
virtual void AddImpulse(const core::float3 & _impulse) = 0;
};
}

0 comments on commit a9c7410

Please sign in to comment.