Difference between revisions of "Oolite JavaScript Reference: Entity"
m (Rearranged) |
m (Made position and orientation read-only (see [http://www.aegidian.org/bb/viewtopic.php?p=34504#34504])) |
||
Line 12: | Line 12: | ||
=== <code>position</code> === | === <code>position</code> === | ||
− | position [read- | + | position [read-only [[Oolite/Development/Scripting/Class/Vector|Vector]]] |
The position of the entity in system co-ordinates. | The position of the entity in system co-ordinates. | ||
+ | |||
+ | '''See Also:''' <code>[[#setPosition|setPosition]]()</code> | ||
=== <code>velocity</code> === | === <code>velocity</code> === | ||
− | velocity [read- | + | velocity [read-only [[Oolite/Development/Scripting/Class/Vector|Vector]]] |
The velocity of the entity in system units (nominal metres) per second. | The velocity of the entity in system units (nominal metres) per second. | ||
=== <code>speed</code> === | === <code>speed</code> === | ||
− | speed [read- | + | speed [read-only double] |
The speed of the entity in system units (nominal metres) per second. | The speed of the entity in system units (nominal metres) per second. | ||
Line 26: | Line 28: | ||
=== <code>orientation</code> === | === <code>orientation</code> === | ||
− | orientation [read- | + | orientation [read-only [[Oolite/Development/Scripting/Class/Quaternion|Quaternion]]] |
The spacial orientation of the entity. | The spacial orientation of the entity. | ||
+ | |||
+ | '''See Also:''' <code>[[#setOrientation|setOrientation]]()</code> | ||
=== <code>heading</code> === | === <code>heading</code> === | ||
Line 56: | Line 60: | ||
maxEnergy [read-only double] | maxEnergy [read-only double] | ||
The highest permissible value of <code>[[#energy|energy]]</code>. | The highest permissible value of <code>[[#energy|energy]]</code>. | ||
+ | |||
+ | == Methods == | ||
+ | === <code>setPosition</code> === | ||
+ | void setPosition([[Oolite/Development/Scripting/Class/Vector#Vector Expressions|vectorExpression]]) | ||
+ | Instantaneously move the entity to the specified position. | ||
+ | |||
+ | === <code>setOrientation</code> === | ||
+ | void setOrientation([[Oolite/Development/Scripting/Class/Quaternion#Quaternion Expressions|quaternionExpression]]) | ||
+ | Instantaneously rotate the entity to the specified orientation. | ||
[[Category:Oolite scripting]] [[Category:Oolite Development]] | [[Category:Oolite scripting]] [[Category:Oolite Development]] |
Revision as of 12:51, 6 April 2007
The Entity
class represents an object in the game universe – Vessel
s, Station
s and CelestialBody
s are common types of entity. Note that these more specific types have additional properties and methods.
Contents
Universal IDs
Every Entity
has an unique universal ID. All Oolite-provided functions which take an Entity
as an argument may also be passed an integer representing the Entity
’s ID.
Properties
ID
ID [read-only integer]
The universal ID of the entity.
position
position [read-only Vector]
The position of the entity in system co-ordinates.
See Also: setPosition()
velocity
velocity [read-only Vector]
The velocity of the entity in system units (nominal metres) per second.
speed
speed [read-only double]
The speed of the entity in system units (nominal metres) per second.
entity.speed()
is equivalent to entity.velocity().magnitude()
.
orientation
orientation [read-only Quaternion]
The spacial orientation of the entity.
See Also: setOrientation()
heading
heading [read-only Vector]
The heading of the entity. This is equivalent to orientation
, but ignoring the axial twist component (roll in the case of a ship).
status
status [read-only string]
The current status of the entity (such as “STATUS_IN_FLIGHT” and “STATUS_BEING_SCOOPED”).
scanClass
scanClass [read-only string]
The current scan class of the entity (such as “CLASS_NEUTRAL” and “CLASS_CARGO”).
mass
mass [read-only double]
The mass of the entity. Currently, this is directly proportional to the volume.
owner
owner [read-only Entity]
The entity which owns this one. In the case of a subentity, the entity to which it is attached. In the case of a defense ship, the station it belongs to. In the case of a missile, the ship that launched it. There may be other uses.
energy
energy [read-write double]
The entity’s total energy; ranges from 0 to maxEnergy
.
maxEnergy
maxEnergy [read-only double]
The highest permissible value of energy
.
Methods
setPosition
void setPosition(vectorExpression)
Instantaneously move the entity to the specified position.
setOrientation
void setOrientation(quaternionExpression)
Instantaneously rotate the entity to the specified orientation.