Heirarchy stuff
| 1119 | |
| 1120 | //Heirarchy stuff |
| 1121 | void Entity::addObject(SimObject* object) |
| 1122 | { |
| 1123 | Component* component = dynamic_cast<Component*>(object); |
| 1124 | if (component) |
| 1125 | { |
| 1126 | addComponent(component); |
| 1127 | return; |
| 1128 | } |
| 1129 | |
| 1130 | Entity* e = dynamic_cast<Entity*>(object); |
| 1131 | if (e) |
| 1132 | { |
| 1133 | MatrixF offset; |
| 1134 | |
| 1135 | //offset.mul(getWorldTransform(), e->getWorldTransform()); |
| 1136 | |
| 1137 | //check if we're mounting to a node on a shape we have |
| 1138 | String node = e->getDataField("mountNode", NULL); |
| 1139 | if (!node.isEmpty()) |
| 1140 | { |
| 1141 | RenderComponentInterface *renderInterface = getComponent<RenderComponentInterface>(); |
| 1142 | if (renderInterface) |
| 1143 | { |
| 1144 | TSShape* shape = renderInterface->getShape(); |
| 1145 | S32 nodeIdx = shape->findNode(node); |
| 1146 | |
| 1147 | mountObject(e, nodeIdx, MatrixF::Identity); |
| 1148 | } |
| 1149 | else |
| 1150 | { |
| 1151 | mountObject(e, MatrixF::Identity); |
| 1152 | } |
| 1153 | } |
| 1154 | else |
| 1155 | { |
| 1156 | /*Point3F posOffset = mPos - e->getPosition(); |
| 1157 | mPos = posOffset; |
| 1158 | |
| 1159 | RotationF rotOffset = mRot - e->getRotation(); |
| 1160 | mRot = rotOffset; |
| 1161 | setMaskBits(TransformMask); |
| 1162 | mountObject(e, MatrixF::Identity);*/ |
| 1163 | |
| 1164 | mountObject(e, MatrixF::Identity); |
| 1165 | } |
| 1166 | |
| 1167 | //e->setMountOffset(e->getPosition() - getPosition()); |
| 1168 | |
| 1169 | //Point3F diff = getWorldTransform().toEuler() - e->getWorldTransform().toEuler(); |
| 1170 | |
| 1171 | //e->setMountRotation(Point3F(mRadToDeg(diff.x),mRadToDeg(diff.y),mRadToDeg(diff.z))); |
| 1172 | |
| 1173 | //mountObject(e, offset); |
| 1174 | } |
| 1175 | else |
| 1176 | { |
| 1177 | SceneObject* so = dynamic_cast<SceneObject*>(object); |
| 1178 | if (so) |
no test coverage detected