component.physicscomponent - ICE 0.1 API documentation

ICE 0.1 API documentation

# component.physicscomponent

Component providing physics support to an entity.

struct PhysicsComponent;

  Component providing physics support to an entity.

  Vector2f position;

    Position in world space.

  float rotation;

    Rotation in world space, in radians.

  Vector2f velocity;

    Velocity in world space.

  bool spawnAbsolutePosition;

    If true, position will be set in absolute coordinates after spawning (instead of relative to the spawner).

  bool spawnAbsoluteRotation;

    If true, rotation will be set in absolute angle after spawning (instead of relative to the spawner).

  bool spawnAbsoluteVelocity;

    If true, velocity will be set in absolute coordinates after spawning (instead of relative to the spawner).

  this(ref Node node);

    Load from a YAML node. Throws YAMLException on error.

  this(Vector2!(float) pos, float rot, Vector2!(float) velocity);

    Construct manually.

  void setRelativeTo(ref PhysicsComponent rhs);

    Set this component as relative to specified component.

    E.g if position of rhs is (1, 0), and position of this component is (2, 0), the resulting position is (3, 0) (assuming no rotation).
    I.e. this component was at (1, 0) relative to rhs, and now it is (3, 0) - in global coordinates.
    Note that if spawnAbsolutePosition is true, position will be set in absolute coordinates. Similarly for spawnAbsoluteRotation and spawnAbsoluteVelocity.

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.