From f18bcfbb4ff2bedae2f4565b823f822a31b1344c Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Mon, 6 Nov 2023 15:21:39 -0500 Subject: don't fumble collision settings and mass in the editor --- src/game.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 6d80198..cd27812 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -315,6 +315,8 @@ void ParseInstance(std::ifstream &stream) { auto entityHandle = ECS_CreateEntity(); auto &compInst = ECS_CreateInstance(entityHandle, et.entityHandle); + compInst.physicsLayer = comp.physicsLayer; + compInst.physicsMask = comp.physicsMask; btVector3 localInertia(0, 0, 0); et.bt.shape->calculateLocalInertia(instPos.mass, localInertia); compInst.bt.motionState = Pke_New(MemBkt_Bullet); @@ -532,6 +534,8 @@ void Game_Tick(double delta) { EntityHandle newEntity = ECS_CreateEntity(); auto &compInst = ECS_CreateInstance(newEntity, createInfo.entityTypeEntityHandle); + compInst.physicsLayer = et.bt.startingCollisionLayer; + compInst.physicsMask = et.bt.startingCollisionMask; btVector3 localInertia(0, 0, 0); et.bt.shape->calculateLocalInertia(et.bt.startingMass, localInertia); btTransform posRot{}; @@ -943,6 +947,7 @@ void RecordImGui_CompInstPos(bool readonly, CompInstance *component) { InstPos instPos; component->bt.motionState->getWorldTransform(instPos.posRot); instPos.scale = component->bt.rigidBody->getCollisionShape()->getLocalScaling(); + instPos.mass = component->bt.rigidBody->getMass(); btVector3 pos = instPos.posRot.getOrigin(); btQuaternion rot = instPos.posRot.getRotation(); -- cgit v1.2.3