diff --git a/radiantcore/entity/EntityNode.cpp b/radiantcore/entity/EntityNode.cpp index 5f44b050a2..281a67aa44 100644 --- a/radiantcore/entity/EntityNode.cpp +++ b/radiantcore/entity/EntityNode.cpp @@ -148,6 +148,16 @@ void EntityNode::createAttachedEntities() ); } +void EntityNode::transformChanged() +{ + Node::transformChanged(); + + // Broadcast transformChanged to all attached entities so they can update + // their position + for (auto attached: _attachedEnts) + attached->transformChanged(); +} + void EntityNode::onEntityClassChanged() { // By default, we notify the KeyObservers attached to this entity diff --git a/radiantcore/entity/EntityNode.h b/radiantcore/entity/EntityNode.h index d2f846b64e..a4622790db 100644 --- a/radiantcore/entity/EntityNode.h +++ b/radiantcore/entity/EntityNode.h @@ -103,6 +103,7 @@ class EntityNode : // IEntityNode implementation Entity& getEntity() override; virtual void refreshModel() override; + void transformChanged() override; // RenderEntity implementation virtual float getShaderParm(int parmNum) const override; diff --git a/test/Entity.cpp b/test/Entity.cpp index ad5384b67e..44c1d05885 100644 --- a/test/Entity.cpp +++ b/test/Entity.cpp @@ -602,10 +602,6 @@ TEST_F(EntityTest, RenderAttachedLightEntity) RenderFixture rf(true /* solid mode */); rf.renderSubGraph(torch); - // The node visitor should have visited the entity itself and one child node (a - // static model) - EXPECT_EQ(rf.nodesVisited, 2); - // There should be 3 renderables from the torch (because the entity has a // shadowmesh and a collision mesh as well as the main model) and one from // the light (the origin diamond).