Packagecom.smartfoxserver.v2.requests.mmo
Classpublic class SetUserPositionRequest
InheritanceSetUserPositionRequest Inheritance com.smartfoxserver.v2.requests.BaseRequest

Updates the User position inside an MMORoom.

MMORooms represent virtual environments and can host any number of users. Based on their position, the system allows users within a certain range from each other (Area of Interest, or AoI) to interact. This request allows the current user to update his position inside the MMORoom, which in turn will trigger a SFSEvent.PROXIMITY_LIST_UPDATE event for all users that fall within his AoI.

View the examples

See also

proximityListUpdate event
MMORoom


Public Methods
 MethodDefined By
  
SetUserPositionRequest(pos:Vec3D, theRoom:Room = null)
Creates a new SetUserPositionRequest instance.
SetUserPositionRequest
Constructor Detail
SetUserPositionRequest()Constructor
public function SetUserPositionRequest(pos:Vec3D, theRoom:Room = null)

Creates a new SetUserPositionRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters
pos:Vec3D — The user position.
 
theRoom:Room (default = null) — The MMORoom object corresponding to the Room where the position should be set; if null, the last Room joined by the user is used.

See also

Examples
The following example changes the position of the user in a 2D coordinates space:
     
     private function updatePlayerPosition(px:int, py:int):void
     {
         var newPos:Vec3D = new Vec3D(px, py);
         sfs.send(new SetUserPositionRequest(newPos));
     }