MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / AddForce

Method AddForce

engine/Poseidon/World/Simulation/Simul.cpp:473–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471}
472
473void Entity::AddForce(Vector3Par pos, Vector3Par force, Color color)
474{
475 LODShapeWithShadow* forceArrow = GScene->ForceArrow();
476 float size = force.Size() * 0.05;
477 if (size > 1)
478 {
479 size = 1;
480 }
481
482 Ref<Object> arrow = new ObjectColored(forceArrow, -1);
483 Vector3 aside = force.CrossProduct(VAside);
484 Vector3 zAside = force.CrossProduct(VForward);
485 if (zAside.SquareSize() > aside.SquareSize())
486 {
487 aside = zAside;
488 }
489 arrow->SetPosition(pos);
490 arrow->SetOrient(force, aside);
491 arrow->SetPosition(arrow->PositionModelToWorld(forceArrow->BoundingCenter() * size));
492 arrow->SetScale(size);
493 arrow->SetConstantColor(PackedColor(Color(color)));
494 GLandscape->ShowObject(arrow);
495}
496
497void Entity::OrientationSurface()
498{

Callers

nothing calls this directly

Calls 13

ColorClass · 0.85
ForceArrowMethod · 0.80
PositionModelToWorldMethod · 0.80
BoundingCenterMethod · 0.80
ShowObjectMethod · 0.80
PackedColorClass · 0.50
SizeMethod · 0.45
CrossProductMethod · 0.45
SquareSizeMethod · 0.45
SetPositionMethod · 0.45
SetOrientMethod · 0.45
SetScaleMethod · 0.45

Tested by

no test coverage detected