Sphere.Pos

From Liberty Unleashed Wiki
Revision as of 14:44, 13 March 2011 by Juppi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

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:

  1. Vector Sphere.Pos
  1. 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.

  1.  
  2. function onPlayerEnterSphere( player, sphere )
  3. {
  4. MessagePlayer( "The current position of this sphere is: " + sphere.Pos, player );
  5. return 1;
  6. }
  7.  

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

  1.  
  2. function onPlayerEnterSphere( player, sphere )
  3. {
  4. local pos = player.Pos;
  5. sphere.Pos = Vector( pos.x + 2.0, pos.y, pos.z );
  6. return 1;
  7. }
  8.  

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.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox