Class SFS2X.Requests.MMO.SetUserPositionRequest

Updates the User position inside an MMORoom.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new SetUserPositionRequest instance.

Class Detail

SFS2X.Requests.MMO.SetUserPositionRequest(pos, targetRoom)
Creates a new SetUserPositionRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

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 proximityListUpdate event for all users that fall within his AoI.

The following example changes the position of the user in a 2D coordinates space:

function updatePlayerPosition(px, py)
{
	var newPos = new SFS2X.Entities.Data.Vec3D(px, py);
	sfs.send(new SFS2X.Requests.MMO.SetUserPositionRequest(newPos));
}
Parameters:
{Vec3D} pos
The user position.
{MMORoom} targetRoom Optional, 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:
SFS2X.SmartFox#send
SFS2X.SFSEvent.PROXIMITY_LIST_UPDATE
SFS2X.Entities.MMORoom