Sphere.Pos
From Liberty Unleashed Wiki
This Sphere class member returns or sets the position of the given sphere.
Syntax
You can either return or set a new value using this member:
Vector Sphere.Pos
Sphere.Pos = Vector vPos
Arguments
- vPos - This is the position of the sphere as a vector
Example 1. Returning
This example will return the position of the sphere when the player hits it.
function onPlayerEnterSphere( player, sphere ) { MessagePlayer( "The current position of this sphere is: " + sphere.Pos, player ); return 1; }
Notes
The function MessagePlayer and callback onPlayerEnterSphere were used in this example. More info about them can be found in the corresponding pages.
Example 2. Setting
function onPlayerEnterSphere( player, sphere ) { local pos = player.Pos; sphere.Pos = Vector( pos.x + 2.0, pos.y, pos.z ); return 1; }
This example will set the position of the sphere to be 2 x co-ordinates away from the player that hit it.
Notes
The callback onPlayerEnterSphere was used in this example. More info about it can be found in the corresponding page.