Skip to main content

Body attachment positions

Many functions, like ImageSprite and PolygonCollider, require attaching a shape to a body at a particular position. When the body moves or rotates, the shape moves and rotates with it. Easel has a number of common parameters that can be used to define how the position and orientation of the shape relates to the body and the screen.

Shape space

The following parameters affect the shape itself:

  • scale - scales the shape around shape's origin.
  • angleOffset rotates the shape around the shape's origin.

Body space

  • bodyOffset - defines the relative position of the shape to the body's position.
  • bodyScale - scales the shape around the body's origin
  • heading - rotates the shape around the body's origin, unless noRotation=true.

Screen space

  • screenOffset - offsets the shape along the horizontal and vertical axes of the screen.

Functions that take transformation parameters

You will see these parameters on functions like:

Not all parameters are used by all functions. For example, PolygonCollider does not use screenOffset as the concept of a "screen" or a "camera" does not exist for the physics engine.