| 1067 | } |
| 1068 | |
| 1069 | void PhysicsWorld::beforeSimulation(Node* node, |
| 1070 | const Mat4& parentToWorldTransform, |
| 1071 | float nodeParentScaleX, |
| 1072 | float nodeParentScaleY, |
| 1073 | float parentRotation) |
| 1074 | { |
| 1075 | auto scaleX = nodeParentScaleX * node->getScaleX(); |
| 1076 | auto scaleY = nodeParentScaleY * node->getScaleY(); |
| 1077 | auto rotation = parentRotation + node->getRotation(); |
| 1078 | |
| 1079 | auto nodeToWorldTransform = parentToWorldTransform * node->getNodeToParentTransform(); |
| 1080 | |
| 1081 | auto physicsBody = node->getPhysicsBody(); |
| 1082 | if (physicsBody) |
| 1083 | { |
| 1084 | physicsBody->beforeSimulation(parentToWorldTransform, nodeToWorldTransform, scaleX, scaleY, rotation); |
| 1085 | } |
| 1086 | |
| 1087 | for (auto&& child : node->getChildren()) |
| 1088 | beforeSimulation(child, nodeToWorldTransform, scaleX, scaleY, rotation); |
| 1089 | } |
| 1090 | |
| 1091 | void PhysicsWorld::afterSimulation(Node* node, const Mat4& parentToWorldTransform, float parentRotation) |
| 1092 | { |
nothing calls this directly
no test coverage detected