MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / addObject

Method addObject

Engine/source/T3D/entity.cpp:1121–1193  ·  view source on GitHub ↗

Heirarchy stuff

Source from the content-addressed store, hash-verified

1119
1120//Heirarchy stuff
1121void 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)

Callers 15

ForestEditorGuiFunction · 0.45
MECreateUndoActionFunction · 0.45
ForestEditorGuiFunction · 0.45
MECreateUndoActionFunction · 0.45
addListenerMethod · 0.45
allocateAndRegisterMethod · 0.45
onAddMethod · 0.45
ShadowMapPassMethod · 0.45
lightSceneMethod · 0.45
onAddMethod · 0.45
getServerSetMethod · 0.45
onAddMethod · 0.45

Calls 9

getDataFieldMethod · 0.80
asMatrixFMethod · 0.80
RotationFClass · 0.50
isEmptyMethod · 0.45
getShapeMethod · 0.45
findNodeMethod · 0.45
getPositionMethod · 0.45
getTransformMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected