Object.Angle

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events


This Object class member returns or sets the angle of the given object.

Syntax

You can either return or set a new value using this member:

  1. Vector object.Angle
  1. object.Angle = Vector vAngle

Arguments

  • vAngle - This is the new Angle for the object as a Vector

Example 1. Returning

This will return the rotational angles (x, y, z) of object ID 0 when the player types '/rotate'

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "rotate" )
  5. {
  6. local pObject = FindObject( 0 );
  7. if ( pObject ) MessagePlayer( "Object ID 0, Angle - " + pObject.Angle, pPlayer );
  8. }
  9. return 1;
  10. }
  11.  

Notes

The functions FindObject and MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Example 2. Setting

This will set the rotational angles (x, y, z) of object ID 0 when the player types '/rotate2'

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "rotate2" )
  5. {
  6. local pObject = FindObject( 0 );
  7. if ( pObject ) pObject.Angle = Vector( 0.00, 5.00, 5.00 );
  8. }
  9. return 1;
  10. }
  11.  

Notes

The function FindObject and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox