|def moveToPoint( self, destination, velocity, distance, userData, faceMovement, moveVertically ):|
|def cancelController( self, controllerID ):|
|def onEnterWorld( self ):|
|def onLeaveWorld( self ):|
|def onEnterSpace( self ):|
|def onLeaveSpace( self ):|
|direction||Tuple of 3 floats as (roll, pitch, yaw)|
A detailed descriptionInstances of the class Entity represent game objects on the client.
An Entity can access its equivalent entities in the base and cell applications via ENTITYCALL. This requires a set of remotely-invoked functions (specified in the entity's .def file).
Member functions documentation
def moveToPoint( self, destination, velocity, distance, userData, faceMovement, moveVertically ):
Moves the Entity to the given coordinate point in a straight line. The callback will be called on success or failure.
Any Entity can only have one motion controller at any time. Repeatedly calling any move function will terminate the previous move controller.
Returns a controller ID that can be used to cancel this move.
You can use Entity.cancelController( movementID ) or Entity.cancelController( "Movement" ) to cancel the move. The callback will not be called if the move is cancelled.
The callback functions are defined as follows:
def onMove( self, controllerID, userData ): def onMoveOver( self, controllerID, userData ): def onMoveFailure( self, controllerID, userData ):
|destination||Vector3, the target point to which the Entity is to be moved.|
|velocity||float, the speed to move the Entity (in m/s).|
|distance||float, the distance target which if it is within, movement is stopped. If the value is 0, it moves to the target position.|
|userData||object, user data passed to the callback function.|
|faceMovement||bool, True if the entity faces the direction of the move. If it is other mechanism, it is False.|
|moveVertically||bool, set to True means to move in a straight line directly to the point, and False means to move in a straight line paralell to the ground.|
|int, newly created controller ID.|
def cancelController( self, controllerID ):
The cancelController function stops the effect of a controller on the Entity. It can only be called on a real entity.
|controllerID||integer, the index of the controller to cancel. A special controller type string can also be used. For example, only one movement/navigation controller can be activated at a time. This can be cancelled with entity.cancelController("Movement").|
Callback functions documentation
def onEnterWorld( self ):
If the entity is a client-controlled entity, it indicates that the entity has created a cell on the server and entered space.
def onLeaveWorld( self ):
If the entity is a client-controlled entity, it indicates that the entity has destroyed the cell on the server and left space.
def onEnterSpace( self ):
def onLeaveSpace( self ):
cell is the ENTITYCALL used to contact the cell entity. This attribute is Read-only, and is None if the base entity has no associated cell.
cellData is a dictionary property. Whenever the base entity has not created its cell entity, the attributes of the cell entity are stored here.
If the cell entity is created, the values and cellData attributes will be deleted. In addition to the attributes that the cell entity specifies in the entity definition file, it also contains position, direction, and spaceID.
The class name of the entity.
The client (object) to which the current entity belongs.
|Vector3, which contains (roll, pitch, yaw) in radians.|
If it is a client-controlled entity, this attribute will be synchronizd to the server at the time of change, and other entities will be synchronized to the client by the server. The client can determine this value to reduce the cost of accuracy.