Physics.P2.Body#addLine()

addLine(length, offsetX, offsetY, rotation) → {p2.Line}

Adds a Line shape to this Body.
The line shape is along the x direction, and stretches from [-length/2, 0] to [length/2,0].
You can control the offset from the center of the body and the rotation.

Parameters
Name Type Argument Default Description
length number

The length of this line (in pixels)

offsetX number <optional>
0

Local horizontal offset of the shape relative to the body center of mass.

offsetY number <optional>
0

Local vertical offset of the shape relative to the body center of mass.

rotation number <optional>
0

Local rotation of the shape relative to the body center of mass, specified in radians.

Returns
p2.Line -

The Line shape that was added to the Body.

Source code: physics/p2/Body.js (Line 1088)
doc_phaser
2017-02-14 11:01:42
Comments
Leave a Comment

Please login to continue.