O1Library Docs
Fall 2026
Docs API

# HasVelocity

o1.world.objects.HasVelocity
trait HasVelocity extends HasPos

A supertype for objects that have a position and a velocity in two-dimensional space.

## Attributes

Graph
Supertypes
  trait HasPos
  class Object
  trait Matchable
  class Any
Known subtypes
  trait MovingObject
  trait MovingObjectInContainer

## Members list

### Value members

#### Abstract methods

def velocity: Velocity

the object’s velocity

the object’s velocity

## Attributes

#### Concrete methods

def isBoundFor(direction: Direction): Boolean

Determines whether this object is bound for roughly the given direction, as per Direction.sharesQuadrant.

Determines whether this object is bound for roughly the given direction, as per Direction.sharesQuadrant.

## Attributes

def isDownbound: Boolean

Determines whether this object has a downward velocity, as per Direction.isDownward.

Determines whether this object has a downward velocity, as per Direction.isDownward.

## Attributes

def isLeftbound: Boolean

Determines whether this object has a leftward velocity, as per Direction.isLeftward.

Determines whether this object has a leftward velocity, as per Direction.isLeftward.

## Attributes

def isRightbound: Boolean

Determines whether this object has a rightward velocity, as per Direction.isRightward.

Determines whether this object has a rightward velocity, as per Direction.isRightward.

## Attributes

def isUpbound: Boolean

Determines whether this object has an upward velocity, as per Direction.isUpward.

Determines whether this object has an upward velocity, as per Direction.isUpward.

## Attributes

def nextPos: Pos

Returns the `Pos` that this object, moving from its current location at its current velocity, reaches in one unit of time. That is, adds the `dx` and `dy` components of the velocity to the current `Pos` and returns the result.

Returns the `Pos` that this object, moving from its current location at its current velocity, reaches in one unit of time. That is, adds the `dx` and `dy` components of the velocity to the current `Pos` and returns the result.

## Attributes

#### Inherited methods

def distance(another: HasPos): Double

Determines the distance (“as the crow flies”) between this object’s `pos` and that of the given object.

Determines the distance (“as the crow flies”) between this object’s `pos` and that of the given object.

## Attributes

Inherited from:
  HasPos

#### Inherited and Abstract methods

def pos: Pos

the object’s location

the object’s location

## Attributes

Inherited from:
  HasPos