new SetUserPositionRequest(pos[, targetRoom])

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

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.

Example

This example changes the position of the user in a 2D coordinates space.

function updatePlayerPosition(px, py)
{
	var newPos = new SFS2X.Vec3D(px, py);
	sfs.send(new SFS2X.SetUserPositionRequest(newPos));
}

Parameters

Name Type Optional Description

pos

 

 

The user position.

targetRoom

 

Yes

The MMORoom object corresponding to the Room where the position should be set; if null, the last Room joined by the user is used.

Defaults to null.

See also
SmartFox#send
SFSEvent.PROXIMITY_LIST_UPDATE