MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / OnDebugDraw

Method OnDebugDraw

Source/Engine/Level/Actors/AnimatedModel.cpp:1181–1218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1179}
1180
1181void AnimatedModel::OnDebugDraw()
1182{
1183 if (ShowDebugDrawSkeleton && SkinnedModel && AnimationGraph)
1184 {
1185 if (GraphInstance.NodesPose.IsEmpty())
1186 PreInitSkinningData();
1187 Matrix world;
1188 GetLocalToWorldMatrix(world);
1189
1190 // Draw bounding box at the node locations
1191 const float boxSize = Math::Min(1.0f, (float)_sphere.Radius / 100.0f);
1192 OrientedBoundingBox localBox(Vector3(-boxSize), Vector3(boxSize));
1193 for (int32 nodeIndex = 0; nodeIndex < GraphInstance.NodesPose.Count(); nodeIndex++)
1194 {
1195 Matrix transform = GraphInstance.NodesPose[nodeIndex] * world;
1196 Float3 scale, translation;
1197 Matrix3x3 rotation;
1198 transform.Decompose(scale, rotation, translation);
1199 transform = Matrix::Invert(Matrix::Scaling(scale)) * transform;
1200 OrientedBoundingBox box = localBox * transform;
1201 DEBUG_DRAW_WIRE_BOX(box, Color::Green, 0, false);
1202 }
1203
1204 // Nodes connections
1205 for (int32 nodeIndex = 0; nodeIndex < SkinnedModel->Skeleton.Nodes.Count(); nodeIndex++)
1206 {
1207 int32 parentIndex = SkinnedModel->Skeleton.Nodes[nodeIndex].ParentIndex;
1208 if (parentIndex != -1)
1209 {
1210 Float3 parentPos = (GraphInstance.NodesPose[parentIndex] * world).GetTranslation();
1211 Float3 bonePos = (GraphInstance.NodesPose[nodeIndex] * world).GetTranslation();
1212 DEBUG_DRAW_LINE(parentPos, bonePos, Color::Green, 0, false);
1213 }
1214 }
1215 }
1216
1217 ModelInstanceActor::OnDebugDraw();
1218}
1219
1220BoundingBox AnimatedModel::GetEditorBox() const
1221{

Callers

nothing calls this directly

Calls 8

ScalingFunction · 0.85
OnDebugDrawFunction · 0.85
MinFunction · 0.50
Vector3Class · 0.50
InvertFunction · 0.50
IsEmptyMethod · 0.45
CountMethod · 0.45
DecomposeMethod · 0.45

Tested by

no test coverage detected