allow custom orbit rotations directions
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "EntityAdmin.h"
|
||||
#include "FacingComponent.h"
|
||||
#include "MovementIntentComponent.h"
|
||||
#include "OrbitMath.h"
|
||||
#include "PositionComponent.h"
|
||||
#include "tracing.h"
|
||||
|
||||
@@ -45,7 +46,19 @@ void MovementIntentSystem::tick(EntityAdmin& admin)
|
||||
return;
|
||||
}
|
||||
|
||||
const QVector2D delta = intent.target - pos.value;
|
||||
// Resolve the steering destination. For orbit intents, pick the orbit
|
||||
// sense from the ship's current velocity (so ships circling the same
|
||||
// target spread to both sides) and aim at a point on the orbit circle.
|
||||
QVector2D destination = intent.target;
|
||||
if (intent.orbitRadius_tiles > 0.0f)
|
||||
{
|
||||
const float sign = OrbitMath::resolveOrbitSign(pos.value, intent.target,
|
||||
body.velocity_tpt);
|
||||
destination = OrbitMath::computeOrbitDestination(
|
||||
pos.value, intent.target, intent.orbitRadius_tiles, sign);
|
||||
}
|
||||
|
||||
const QVector2D delta = destination - pos.value;
|
||||
const float dist = delta.length();
|
||||
|
||||
if (dist < 0.001f)
|
||||
|
||||
Reference in New Issue
Block a user