Steering

namespace tnt
namespace doo

Variables

struct tnt::doo::steering_sys steer
struct steering_sys
#include <Steering.hpp>

A system that adds support steering behaviours to the objects.

Public Functions

void Seek(object const &id, Vector const &target) const noexcept

Move object id towards target.

Note

Use Pursuit if target is supposed to be moving. It gives more “natural” results.

See

Pursuit

Parameters
  • id: The id of the moving object.

  • target: The desired position in global coordinates.

void Flee(object const &id, Vector const &target) const noexcept

Move object id away from target.

Note

Use RangedFlee if you want obj to stay at a certain distance away from target.

Note

Use Evade if target is supposed to be moving. It gives more “natural” results.

See

RangedFlee

See

Evade

Parameters
  • id: The id of the moving object.

  • target: The position that the object will avoid.

void RangedFlee(object const &id, Vector const &target, float range) const noexcept

Move object id away from target if it is close enough.

See

Flee

See

Evade

Parameters
  • id: The id of the moving object.

  • target: The center of the circular area to be avoided.

  • range: The minimum distance that the object and the target can have.

void Arrive(object const &id, Vector const &target) const noexcept

Direct the given object towards target with a speed that decreases as distance decreases.

Parameters
  • id: The object to make seek towards target.

  • target: The position where obj will be directed to.

void Pursuit(object const &id, object const &target) const noexcept

Direct the first object towards target. Useful when target is supposed to be moving.

Note

Use Seek if target is not supposed to be moving.

See

Seek

Parameters
  • id: The object to make seek towards target.

  • target: The object which obj will follow.

void Evade(object const &id, object const &target) const noexcept

Move object id away from target. Useful when target is supposed to be moving.

Note

Use Flee if target is not supposed to be moving.

See

tnt::steer::Flee

Parameters
  • id: The object to flee away from target.

  • target: The object which obj will avoid.