Recoil while firing, clamp inputs, merge Helicopter

This commit is contained in:
ViktorLjung
2014-05-18 23:54:01 +02:00
parent 85e5d7461c
commit 02243becee
10 changed files with 83 additions and 9 deletions
+11 -1
View File
@@ -35,7 +35,8 @@ void Systems::PhysicsSystem::Initialize()
EVENT_SUBSCRIBE_MEMBER(m_ETankSteer, &Systems::PhysicsSystem::OnTankSteer);
EVENT_SUBSCRIBE_MEMBER(m_ESetVelocity, &Systems::PhysicsSystem::OnSetVelocity);
EVENT_SUBSCRIBE_MEMBER(m_EApplyForce, &Systems::PhysicsSystem::OnApplyForce);
EVENT_SUBSCRIBE_MEMBER(m_EApplyPointImpulse, &Systems::PhysicsSystem::OnApplyPointImpulse);
hkMemorySystem::FrameInfo finfo(6000 * 1024); // Allocate 6MB of Physics solver buffer
hkMemoryRouter* memoryRouter = hkMemoryInitUtil::initDefault(hkMallocAllocator::m_defaultMallocAllocator, finfo);
hkBaseSystem::init(memoryRouter, HavokErrorReport);
@@ -605,3 +606,12 @@ bool Systems::PhysicsSystem::OnApplyForce(const Events::ApplyForce &event)
return true;
}
bool Systems::PhysicsSystem::OnApplyPointImpulse( const Events::ApplyPointImpulse &event )
{
m_PhysicsWorld->markForWrite();
m_RigidBodies[event.Entity]->applyPointImpulse(ConvertPosition(event.Impulse), ConvertPosition(event.Position));
m_PhysicsWorld->unmarkForWrite();
return true;
}