This is the Python API reference documentation for the CellApp portion of BigWorld.

BigWorld Technology 2.1.0. Released 2012.
Software designed and built in Australia by BigWorld.
Level 2, Wentworth Park Grandstand, Wattle St
Glebe NSW 2037, Australia
www.bigworldtech.com
Copyright 1999-2012 BigWorld Pty Ltd. All rights reserved.
This document is proprietary commercial in confidence and access is restricted to authorised users. This document is protected by copyright laws of Australia, other countries and international treaties. Unauthorised use, reproduction or distribution of this document, or any portion of this document, may result in the imposition of civil and criminal penalties as provided by law.

Copyright 1999-2012 BigWorld Pty. Ltd. All rights reserved. Proprietary commercial in confidence.


Actualised - BigWorld cell Documentation

Actualised Classes Reference

The classes listed below are created through factory function or attribute accessors, and can not be instantiated directly (and so are not bound to any module).

See the class documentation for information on accessing these classes.

Class List

BaseEntityMailBox
BaseViaCellMailBox
CellEntityMailBox
CellViaBaseMailBox
ClientCaller
PyClient
PyEntities
PyObjectPlus
PyOutputWriter
PySTLSequence
RemoteEntityMethod
ServerEntityMailBox
SharedData


BWConfig - BigWorld cell Documentation

BWConfig Module Reference

Member Functions

def readBool( configOption ):
def readFloat( configOption ):
def readInt( configOption ):
def readString( configOption ):

Member Function Documentation

def readBool( configOption ):

This method returns the given value from bw.xml.

Parameters:
configOption The path of the option to get.

def readFloat( configOption ):

This method returns the given value from bw.xml.

Parameters:
configOption The path of the option to get.

def readInt( configOption ):

This method returns the given value from bw.xml.

Parameters:
configOption The path of the option to get.

def readString( configOption ):

This method returns the given value from bw.xml.

Parameters:
configOption The path of the option to get.


BWPersonality - BigWorld cell Documentation

BWPersonality Module Reference

The name of this module is actually specified by the personality option in the configuration file. This module should be implemented by the user. It should contain callback methods that will be called by the server at specific events.

It is also possible to register for these events using BigWorld.addEventListener. For example, BigWorld.addEventListener( "onInit", myFunc ).

Member Functions

def onAllSpaceGeometryLoaded( spaceID, isBootstrap, lastpath ):
def onAppReady( isFromDB ):
def onAppShuttingDown( shutdownTime ):
def onCellAppData( key, value ):
def onCellAppReady( ):
def onCellAppShuttingDown( ):
def onDelCellAppData( key ):
def onDelGlobalData( key ):
def onFini( ):
def onGlobalData( key, value ):
def onInit( isReload ):
def onSpaceData( spaceID, entryID, key, value ):
def onSpaceGeometryLoaded( spaceID, mappingName ):

Member Function Documentation

def onAllSpaceGeometryLoaded( spaceID, isBootstrap, lastpath ):

If present, this method is called when BigWorld has finished loading the geometry mapping of a new space. If the space is made up of multiple cells, this callback is called when all of the cells have loaded the geometry mapping (see BigWorld.addSpaceGeometryMapping) for the area covered by each cell. This method is called on simultaneously on each CellApp that contains a cell in the new space.

This callback is never called for spaces with no geometry mappings.

For spaces with a multiple geometry mappings, this callback is called when all the geometry mappings have been loaded. If additional geometry mappings are added to the space after this callback has been called, then this callback will be called again when the new geometry mappings are loaded. However, there is a race condition when multiple geometry mappings are being added to the space: BigWorld may mistakenly call this callback while geometry mappings are still being added to the space. In this case, the lastPath parameter becomes useful. It is set to the path of geometry mapping BigWorld considers to be the last geometry mapping added to the space.

This callback is not called if the game is restored from database - even if the space was loading geometry when it was shutdown.

Parameters:
spaceID | spaceID is the id of the recently created space whose chunks have just finished loading.
isBootstrap | isBootstrap is a boolean value. If the space is comprised of multiple cells, isBootstrap is set to true only for one of the callbacks. This is usually the callback on the CellApp that contains the first cell created for the space but this is not guaranteed.
lastpath | lastpath is the path of the last geometry mapping added to the space.

def onAppReady( isFromDB ):

If present, this method is called on the first CellApp when the default space is ready. If a default space is not used, this callback is never called.

It is often preferable to use BWPersonality.onBaseAppReady instead of this callback.

Parameters:
isFromDB isFromDB is a boolean set to True if the space was created from the database and False if the CellAppMgr created the default space.

def onAppShuttingDown( shutdownTime ):

If present, this method is called when a controlled shutdown has been scheduled.

Parameters:
shutdownTime shutdownTime is the game time that the server is scheduled to shut down at.

def onCellAppData( key, value ):

If present, this method is called whenever a shared CellApp data value is set. This may be when a value is initially set or when it is modified.

Parameters:
key | The key associated with the value.
value | The new value.

def onCellAppReady( ):

def onCellAppShuttingDown( ):

def onDelCellAppData( key ):

If present, this method is called whenever a shared CellApp data value is deleted.

Parameters:
key The key of the value deleted.

def onDelGlobalData( key ):

If present, this method is called whenever a shared Global data value is deleted.

Parameters:
key The key of the value deleted.

def onFini( ):

If present, this method is called whenever the Python script system is about to be completely shut down. This function is called after all stages of onBaseAppShutDown have executed.

def onGlobalData( key, value ):

If present, this method is called whenever a shared Global data value is set. This may be when a value is initially set or when it is modified.

Parameters:
key | The key associated with the value.
value | The new value.

def onInit( isReload ):

If present, this method is called whenever the Python scripts have completed loading.

Parameters:
isReload True if the loading was caused by a call to BigWorld.reloadScript, otherwise, False

def onSpaceData( spaceID, entryID, key, value ):

If present, this method is called whenever a new space data entry is added.

Callbacks may be made for internal BigWorld space data, where the key is in the reserved range between 0 and 255. These calls should be ignored.

Parameters:
spaceID | spaceID is the id of the space the data is being added to.
entryID | entryID is the entry id for the newly added data.
key | key is the key of the newly added data.
value | is the actual data that has been added.

def onSpaceGeometryLoaded( spaceID, mappingName ):

This is a callback function that can be implemented by the user.

If present, this method is called whenever a space geometry is fully loaded on a cell.

Parameters:
spaceID | spaceID is the id of the space where the geometry is loaded.
mappingName | mappingName is the name of the geometry that has been fully loaded. The mappingName is name of the immediate directory name that contains chunk files.


BigWorld - BigWorld cell Documentation

BigWorld Module Reference

Class List

Entity
UserDataObject

Member Functions

def addEventListener( eventName, callback, level ):
def addFrequentTask( callback, level ):
def addFunctionWatcher( path, function, argumentList, exposedHint, desc ):
def addSpaceData( spaceID, key, value ):
def addSpaceGeometryMapping( spaceID, mapper, path, shouldLoadOnServer ):
def addTimer( callback, initialOffset, repeatOffset=0, userArg=0 ):
def addWatcher( path, getFunction, setFunction ):
def address( ):
def chunkTransform( chunkNMapping, spaceID ):
def collide( spaceID, src, dst ):
def configureConnection( spaceID, point1, point2, isOpen ):
def createEntity( class, spaceID, position, direction, state ):
def createEntityOnBaseApp( class, state, callback ):
def debugDump( ):
def delBaseAppData( key ):
def delSpaceData( spaceID, entryID ):
def delSpaceDataForKey( spaceID, key ):
def delTimer( id ):
def delWatcher( path ):
def deregisterFileDescriptor( fileDescriptor ):
def deregisterWriteFileDescriptor( fileDescriptor ):
def executeRawDatabaseCommand( command, callback ):
def fetchURL( url, callback, headers, timeout, method ):
def findChunkFromPoint( point, spaceID ):
def findRandomNeighbourPoint( spaceID, position, radius, girth ):
def findRandomNeighbourPoint( position, radius, girth ):
def findRandomNeighbourPointWithRange( spaceID, position, minRadius, maxRadius, girth ):
def findRandomNeighbourPointWithRange( position, minRadius, maxRadius, girth ):
def getLoad( ):
def getMaterialKinds( ):
def getSpaceData( spaceID, entryID, key ):
def getSpaceDataFirstForKey( spaceID, key ):
def getSpaceDataForKey( spaceID, key ):
def getSpaceGeometryMappings( spaceID ):
def getWatcher( path ):
def getWatcherDir( path ):
def hasStarted( ):
def isNextTickPending( ):
def isShuttingDown( ):
def load( ):
def maxCellAppLoad( ):
def navigatePathPoints( spaceID, src, dst, maxSearchDistance, girth ):
def navigatePathPoints( src, dst, maxSearchDistance, girth ):
def registerFileDescriptor( fileDescriptor, callback ):
def registerWriteFileDescriptor( fileDescriptor, callback ):
def reloadScript( fullReload ):
def removeEventListener( eventName, callback ):
def setBaseAppData( key, value ):
def setSpaceData( spaceID, key, value ):
def setSpaceTimeOfDay( spaceID, initialTimeOfDay, gameSecondsPerSecond ):
def setWatcher( path, val ):
def time( ):
def timeInTicks( ):
def timeOfDay( spaceID ):

Attributes

INVALID_POSITION |
NEXT_ONLY |
VOLATILE_ALWAYS |
VOLATILE_NEVER |
cellAppData |
component |
entities | PyEntities
globalData |

Member Function Documentation

def addEventListener( eventName, callback, level ):

The function addEventListener associates a callback with an event. The callback will be called whenever the event is triggered.

The events that can be listened to are all of the BWPersonality callbacks that do not have a return value. For example, "onInit", "onFini" etc.

Parameters:
eventName | The name of the event to listen for.
callback | A callable object that will be called on this event.
level | An optional integer level. Listeners with a higher level are called later. The default value is 0.

def addFrequentTask( callback, level ):

The function addFrequentTask registers a callback function to be called periodically (at game tick frequency). If the callback ever returns True, it is deregistered and will not be called again.

Parameters:
callback | Specifies the callable to be used. This is a function that takes no parameters.
level | Optional argument for the level to run the task at. This higher the level, the later the task is executed. Currently the only valid levels are 0 and 1.

def addFunctionWatcher( path, function, argumentList, exposedHint, desc ):

This function interacts with the watcher debugging system, allowing the creation of watcher variables.

The addFunctionWatcher function in Python allows the creation of a watcher path that can be queried as well as set with a variable length argument list.

For example:

BigWorld.addFunctionWatcher( "command/addGuards", util.patrollingGuards, [("Number of guards to add", int)], BigWorld.EXPOSE_LEAST_LOADED, "Add an arbitrary number of patrolling guards into the world.")

Raises a TypeError if the "function" argument is not callable.

Parameters:
path | The path the watcher will be created as. Function watchers are generally placed under the "command/" path structure.
function | The function to call to with the provided argument list.
argumentList | The argument list (provided as a tuple) of types and descriptions that the function accepts. See the example for more details about its structure.
exposedHint | The default exposure hint to be used when forwarding the watcher call from Managers to Components.
desc | (Optional) A description of the function watcher behaviour and usage. While this field is optional, it is strongly recommended to provide this description in order to allow usage through WebConsole to be more intuitive.

def addSpaceData( spaceID, key, value ):

If the given key is not in the valid user range of 256 to 32767, or if the spaceID does not refer to a valid space, then a ValueError is raised.

Parameters:
spaceID | the space in which to add the data
key | the key under which to add the space data (between 256 and 32767)
value | the string data to add for this key

Returns:
the new space data entry id for the added data

def addSpaceGeometryMapping( spaceID, mapper, path, shouldLoadOnServer ):

On the server, the geometry from all chunks in the given directory is loaded into the specified space. The chunk files are loaded asynchronously, and when the geometry is fully loaded the following notification method is called on the personality module:
    def onAllSpaceGeometryLoaded( self, spaceID, mappingName ):

The server only loads the data it needs. For example, it only loads the BSP for each model, it does not load textures or the model's full mesh.

Terrain height data is loaded, but not terrain texturing data. To save memory, the server can load lower resolutions of the terrain height data. This is specified in the space.settings file in the space directory. The tag governs which LOD level is chosen. The tag value can be set from 0 to 6. Each level is half the resolution of the previous one, so 0 is the full mesh resolution, 1 is half the resolution, etc.

There is a possibility that onAllSpaceGeometryLoaded() will not be called if the CellAppMgr crashes at the precise moment multiple CellApps simultaneously call this method to add geometry to the same space.

The given transform must be aligned to the chunk grid. That is, it should be a translation matrix whose position is in multiples of 100 on the X and Z axis. Any other transform will result in undefined behaviour.

Any extra space mapped in must use the same terrain system as the first, with the same settings, the behaviour of anything else is undefined.

Parameters:
spaceID | the space in which to operate
mapper | the matrix to map the chunks in at (or None = identity)
path | the path to the directory that contains the chunks
shouldLoadOnServer | Optional boolean argument indicates whether to load the geometry on the server. Defaults to True.

Returns:
the new space data entry id for the added data

def addTimer( callback, initialOffset, repeatOffset=0, userArg=0 ):

The function addTimer registers a function to be called after "initialOffset" seconds. Optionally it can be repeated every "repeatOffset" seconds, and have optional user data (an integer that is simply passed to the timer function) "userArg".

The callback function must accept 2 arguments; the internal id of the timer (useful to remove the timer via the "delTimer" method), and the optional user supplied integer "userArg".

Example:
import BigWorld

# Callback function that accepts 2 parameters; the id of the timer,
# and the specified user argument.

# id is the internal id of the timer, and can be used to remove the
# timer via the use of the BigWorld.delTimer function
def onTimer( self, id, userArg ):
    print "onTimer called: id %i, userArg: %i" % ( id, userArg )
    # if this is a repeating timer then call:
    #     BigWorld.delTimer( id )
    # to remove the timer when it is no longer needed

# call onTimer after 5 seconds, and then every 1 second with a userArg of 9
BigWorld.addTimer( onTimer, 5, 1, 9 )

# call onTimer after 1 second with no repeat and userArg defaulting to a
# value of 0
BigWorld.addTimer( onTimer, 1 )

Parameters:
callback | Specifies the timer handler to be used. This is a function that takes 2 integer parameters.
initialOffset | initialOffset is a float and specifies the interval (in seconds) between registration of the timer, and the time of first execution.
repeatOffset | repeatOffset is an optional float and specifies the interval (in seconds) between repeated executions after the first execution. BigWorld.delTimer must be used to remove the timer or this will repeat continuously.
userArg | userArg is an optional integer which specifies an optional user supplied value to be passed to the callback method.

Returns:
Integer. This function returns the internal id of the timer. This can be used with BigWorld.delTimer to remove the timer.

def addWatcher( path, getFunction, setFunction ):

This function interacts with the watcher debugging system, allowing the creation of watcher variables.

The addWatcher function in Python allows the creation of a particular watcher variable. For example:

>>> maxBandwidth = 20000
>>> def getMaxBps( ):
>>>     return str(maxBandwidth)
>>> def setMaxBps( bps ):
>>>     maxBandwidth = int(bps)
>>>     setBandwidthPerSecond( int(bps) )
>>>
>>> BigWorld.addWatcher( "Comms/Max bandwidth per second", getMaxBps, setMaxBps )

This adds a watcher variable under "Comms" watcher directory. The function getMaxBps is called to obtain the watcher value and setMaxBps is called when the watcher is modified.

Raises a TypeError if getFunction or setFunction is not callable.

Parameters:
path | the path to the item to create.
getFunction | the function to call when retrieving the watcher variable. This function takes no argument and returns a string representing the watcher value.
setFunction | (optional)the function to call when setting the watcher variable This function takes a string argument as the new watcher value. This function does not return a value. If this function does not exist the created watcher is a read-only watcher variable.

def address( ):

This method returns the address of the internal network interface.

def chunkTransform( chunkNMapping, spaceID ):

Parameters:
chunkNMapping | chunkNMapping is a string containing the name of the chunk whose transform is to be returned.
spaceID | spaceID is the id of the space in which the chunk resides.

Returns:
A Matrix which describes the chunk's transform.

def collide( spaceID, src, dst ):

This function performs a collision test along a line segment from one point to another through the collision scene. If the line intersects nothing then the function returns None. Otherwise, it returns a tuple consisting of the point the first collision occurred at, the triangle that was hit (specified by its three points, as Vector3s), and the material type of the poly that was hit (an integer between 0 and 255). This material type corresponds to the material or object Kind specified in ModelViewer (see Object->Properties and Material->Material Properties panes).

For example:
    >>> BigWorld.collide( spaceID, (0, 10, 0), (0,-10,0) )
    ((0.0000, 0.0000, 0.0000), ( (0.0000, 0.0000, 0.0000),
    (4.0000, 0.0000, 0.0000), (4.0000, 0.0000, 4.0000)), 0)
In this example the line goes from 10 units above the origin to 10 units below it. It intersects with a triangle at the origin, where the triangles three points are (0,0,0), (4,0,0) and (4,0,4). The material is of type 0.

Parameters:
spaceID | The space in which to perform the collision.
src | The point to project from.
dst | The point to project to.

Returns:
A 3-tuple of the hit point, the triangle it hit, and the material type or None if nothing was hit.

def configureConnection( spaceID, point1, point2, isOpen ):

This function configures the connection between two demonstrative points that straddle a portal. The connection may be either open or closed.

Parameters:
spaceID | The id of the space in which to operate.
point1 | The first demonstrative point.
point2 | The second demonstrative point.
isOpen | A boolean value indicating whether or not the portal is open.

def createEntity( class, spaceID, position, direction, state ):

Example:
# create an open door entity at the same position as entity "thing"
direction = ( 0, 0, thing.yaw )
properties = { "open":1 }
BigWorld.createEntity( "Door", thing.space, thing.position, direction,
                       properties )

Parameters:
class | class is the name of the class to instantiate. Note that this must be an entity class, as declared in the entities.xml file.
spaceID | spaceID is the id of the space in which to place the entity.
position | position is a sequence of 3 floats containing the position at which the new entity is to be spawned, in world coordinates.
direction | direction is a sequence of 3 floats containing the initial orientation of the new entity (roll, pitch, yaw), relative to the world frame.
state | state is a dictionary describing the initial states of the entity's properties. A property will take on its default value from the .def file if it is not listed here.

Returns:
The new entity.

def createEntityOnBaseApp( class, state, callback ):

This method creates an entity on a BaseApp.

Parameters:
class | class is the name of the class to instantiate. Note that this must be an entity class, as declared in the entities.xml file.
state | state is a dictionary describing the initial states of the entity's properties. A property will take on its default value from the .def file if it is not listed here.
callback | (optional) callback function taking a single argument of the newly created Base mailbox on success, or None on error.

Returns:
None

def debugDump( ):

This method is for debugging only.

def delBaseAppData( key ):

This function deletes a data value that is accessible from all BaseApps. This can be accessed on BaseApps via BigWorld.baseAppData.

The BaseAppMgr is the authoritative copy of this data. If two or more components try to set the same value, the last one to reach the BaseAppMgr will be the one that is kept.

Note: Care should be taken using this functionality. It does not scale well and should be used sparingly.

Parameters:
key The key of the value to be deleted.

def delSpaceData( spaceID, entryID ):

Deletes the space data entry of the given id in the given space. Note that only the data known by the current CellApp is deleted from other CellApps.

A ValueError is raised if the space ID is invalid, or the entry ID does not refer to a mapped entry.

Parameters:
spaceID | the space in which to operate
entryID | the entry to delete

def delSpaceDataForKey( spaceID, key ):

Parameters:
spaceID | the space in which to operate
key | the key to delete space data for

def delTimer( id ):

See BigWorld.addTimer for an example of timer usage.

Parameters:
id id is an integer that specifies the internal id of the timer to be removed.

def delWatcher( path ):

Parameters:
path the path of the watcher to delete.

def deregisterFileDescriptor( fileDescriptor ):

This function deregisters a callback that has been registered with BigWorld.registerFileDescriptor.

Parameters:
fileDescriptor An object that has a fileno method such as a socket or file, or an integer representing a file descriptor.

def deregisterWriteFileDescriptor( fileDescriptor ):

This function deregisters a callback that has been registered with BigWorld.registerWriteFileDescriptor.

Parameters:
fileDescriptor An object that has a fileno method such as a socket or file, or an integer representing a file descriptor.

def executeRawDatabaseCommand( command, callback ):

Please note that the entity data in the database may not be up to date, especially when secondary databases are enabled. It is highly recommended that this function is not used to read or modify entity data.

Parameters:
command | The command string specific to the present database layer. For MySQL database it is an SQL query.
callback | The object to call back (e.g. a function) with the result of the command execution.

def fetchURL( url, callback, headers, timeout, method ):

Keyword arguments are supported for this function.

Parameters:
url | The URL to retrieve.
callback | The callable object that receives the response object. The response object has body and responseCode properties.
headers | An optional sequence of strings to be added to the request's HTTP headers.
timeout | Option argument for the number of seconds before this call should time out.
method | "GET" or "PUT" to indicate the HTTP method.

def findChunkFromPoint( point, spaceID ):

Parameters:
point | point is a Vector3 describing the location to search for a chunk, in world space.
spaceID | spaceID is the id of the space to search in.

Returns:
The name of the chunk found, as a string.

def findRandomNeighbourPoint( spaceID, position, radius, girth ):

Parameters:
spaceID | (int) The ID of the space in which to operate.
position | (Vector3) The position of the point
radius | (float) The radius to search, in metres.
girth | (optional float) Which navigation girth to use (optional and defaults to 0.5).

Returns:
(Vector3) The random point found.

def findRandomNeighbourPoint( position, radius, girth ):

Parameters:
position | (Vector3) The position of the point
radius | (float) The radius to search
girth | (optional float) Which navigation girth to use (optional and default to 0.5)

Returns:
(Vector3) The random point found

def findRandomNeighbourPointWithRange( spaceID, position, minRadius, maxRadius, girth ):

Parameters:
spaceID | (int) The ID of the space in which to operate.
position | (Vector3) The position of the point to find a random point around.
minRadius | (float) The minimum radius to search.
maxRadius | (float) The maximum radius to search.
girth | (optional float) Which navigation girth to use (defaults to 0.5).

Returns:
(Vector3) The random point found.

def findRandomNeighbourPointWithRange( position, minRadius, maxRadius, girth ):

Parameters:
position | (Vector3) The position of the point
minRadius | (float) The minimum radius to search
maxRadius | (float) The maximum radius to search
girth | (optional float) Which navigation girth to use (optional and default to 0.5)

Returns:
(Vector3) The random point found

def getLoad( ):

This method returns the current CellApp load.

Returns:
The current CellApp load as a float.

def getMaterialKinds( ):

This method returns a list of id and section tuples of the material kind list, in the order in which they appear in the XML file

Returns:
The list of (id, DataSection) tuples of material kinds

def getSpaceData( spaceID, entryID, key ):

Parameters:
spaceID | the space in which to operate
entryID | the entry to get data for
key | the key of the entry. Pass -1 if the key is not known, to perform a slower query.

Returns:
a tuple of (key, value) for the entry if found

def getSpaceDataFirstForKey( spaceID, key ):

Parameters:
spaceID | the space in which to operate
key | the key to get data for

Returns:
the value of the first entry for the key

def getSpaceDataForKey( spaceID, key ):

Parameters:
spaceID | the space in which to operate
key | the key to get data for

Returns:
a tuple of (entryID, value) for each entry under the given key

def getSpaceGeometryMappings( spaceID ):

This function returns a list of the client-server geometry mappings of the space with the given space ID. Each list element consists of a tuple of the mapping, its transform matrix and a boolean indicating whether it is client only.

Parameters:
spaceID The id of the space to query.

def getWatcher( path ):

This function interacts with the watcher debugging system, allowing the retrieval of watcher variables.

The watcher debugging system allows various variables to be displayed and updated from within the runtime.

Watchers are specified in the C-code using the MF_WATCH macro. This takes three arguments, the first is a string specifying the path (parent groups followed by the item name, separated by forward slashes), the second is the expression to watch. The third argument specifies such things as whether it is read only or not, and has a default of read-write.

The getWatcher function in Python allows the getting of a particular value. For example:

>>>	BigWorld.getWatcher( "Client Settings/Terrain/draw" )
1

Raises a TypeError if the watcher was not found.

Parameters:
path the path to the item to modify.

Returns:
the value of that watcher variable.

def getWatcherDir( path ):

This function interacts with the watcher debugging system, allowing the inspection of a directory watcher.

Raises a TypeError if not found.

Parameters:
path the path to the item to modify.

Returns:
a list containing an entry for each child watcher. Each entry is a tuple of child type, label and value. The child type is 1 for read-only, 2 for read-write and 3 for a directory.

def hasStarted( ):

def isNextTickPending( ):

This can be controlled by the cellApp/reservedTickFraction setting in bw.xml.

Returns:
isNextTickPending returns True if the next tick is pending, False otherwise.

def isShuttingDown( ):

def load( ):

This function returns the current load of this CellApp. This can be useful for deciding to disallow some script actions when the server is overloaded.

def maxCellAppLoad( ):

This function returns the maximum current load of any CellApp. This can be useful for deciding to disallow some script actions when the server is overloaded.

def navigatePathPoints( spaceID, src, dst, maxSearchDistance, girth ):

Return a path of points between the given source and destination points in the space of the given space ID. The space must be loaded on this CellApp.

Parameters:
spaceID | (int) The space ID.
src | (Vector3) The source point in the space.
dst | (Vector3) The destination point in the space.
maxSearchDistance | (float) The maximum search distance, defaults to maxAoIRadius.
girth | (float) The navigation girth grid to use, defaults to 0.5m.

Returns:
(list) A list of Vector3 points between the source point to the destination point.

def navigatePathPoints( src, dst, maxSearchDistance, girth ):

Return a path of points between the given source and destination points in the camera space.

Parameters:
src | (Vector3) The source point in the space.
dst | (Vector3) The destination point in the space.
maxSearchDistance | (float) The maximum search distance, defaults to 500m.
girth | (float) The navigation girth grid to use, defaults to 0.5m.

Returns:
(list) A list of Vector3 points between the source point to the destination point.

def registerFileDescriptor( fileDescriptor, callback ):

This function registers a callback that will be called whenever there is data for reading on the input file descriptor.

Parameters:
fileDescriptor | An object that has a fileno method such as a socket or file, or an integer representing a file descriptor.
callback | A callable object that expects the fileDescriptor object as its only argument.

def registerWriteFileDescriptor( fileDescriptor, callback ):

This function registers a callback that will be called when the input file descriptor is available for writing.

Parameters:
fileDescriptor | An object that has a fileno method such as a socket or file, or an integer representing a file descriptor.
callback | A callable object that expects the fileDescriptor object as its only argument.

def reloadScript( fullReload ):

This method reloads Python modules related to entities and custom data types. The class of current entities are set to the newly loaded classes. This method should be used for development only and is not suitable for production use. The following points should be noted:

1) Scripts are only reloaded on the component cellapp that this method is called on. The user is responsible for making sure that reloadScript is called on all server components.

2) The client doesn't have equivalent functionality in Python. Each BigWorld client needs to use CapsLock + F11 in order to reload the scripts.

3) Doesn't handle custom data types transparently. Instances of custom data types must have their __class__ reassigned to the proper class type after reloadScript() completes. For example, if we have a custom data type named "CustomClass":

for e in BigWorld.entities.values():
   if type( e ) is Avatar.Avatar:
      e.customData.__class__ = CustomClass
BWPersonality.onInit( True ) is called when this method completes (where BWPersonality is the name of the personality module specified in <root>/<personality> in bw.xml).

Parameters:
fullReload Optional boolean parameter that specifies whether to reload entity definitions as well. If this parameter is False, then entities definitions are not reloaded. Default is True.

Returns:
True if reload successful, False otherwise.

def removeEventListener( eventName, callback ):

The function removeEventListener removes an event listener associated with an event previously added using BigWorld.addEventListener.

Parameters:
eventName | The name of the event that was listened for.
callback | The callable object that should be removed.

def setBaseAppData( key, value ):

This function sets a data value that is accessible from all BaseApps. This can be accessed on BaseApps via BigWorld.baseAppData.

The BaseAppMgr is the authoritative copy of this data. If two or more components try to set the same value, the last one to reach the BaseAppMgr will be the one that is kept.

Note: Care should be taken using this functionality. It does not scale well and should be used sparingly.

Parameters:
key | The key of the value to be set.
value | The new value.

def setSpaceData( spaceID, key, value ):

Parameters:
spaceID | the space in which to add the data
key | the key under which to add the space data (between 256 and 32767). Keys between 256 and 16383 are sent to the client. Keys between 16384 and 32767 are not sent to the client; they are only available to the CellApps. Keys 0 to 255 are reserved for internal use.
value | the string data to add for this key

Returns:
the new space data entry id for the added data

def setSpaceTimeOfDay( spaceID, initialTimeOfDay, gameSecondsPerSecond ):

Parameters:
spaceID | the space in which to operate
initialTimeOfDay | the time of day at BigWorld.time() 0
gameSecondsPerSecond | the game seconds that pass for each real second

Returns:
the new space data entry id for the added data

def setWatcher( path, val ):

This function interacts with the watcher debugging system, allowing the setting of watcher variables.

The watcher debugging system allows various variables to be displayed and updated from within the runtime.

Watchers are specified in the C-code using the MF_WATCH macro. This takes three arguments, the first is a string specifying the path (parent groups followed by the item name, separated by forward slashes), the second is the expression to watch. The third argument specifies such things as whether it is read only or not, and has a default of read-write.

The setWatcher function in Python allows the setting of a particular read-write value. For example:

>>>	BigWorld.setWatcher( "Client Settings/Terrain/draw", 0 )

Raises a TypeError if the watcher failed to be set. Raises a TypeError if args cannot be converted into a string.

Parameters:
path | the path to the item to modify.
val | the new value for the item.

def time( ):

This method returns the current game time in seconds as a floating point number.

Returns:
The current game time in seconds as a double.

def timeInTicks( ):

This method returns the current game time in ticks.

Returns:
The current game time in ticks.

def timeOfDay( spaceID ):

Parameters:
spaceID the space to get the time of day for

Returns:
the time of day in seconds since midnight, or -1 if unset

Attribute Documentation

INVALID_POSITION

NEXT_ONLY

VOLATILE_ALWAYS

VOLATILE_NEVER

cellAppData

For example:
BigWorld.cellAppData[ "hello" ] = "there"

Another CellApp can access this as follows:
print BigWorld.cellAppData[ "hello" ]

The key and value can be any type that can be pickled and unpickled on all destination components.

When a value is changed or deleted, a callback function is called on all components. See: BWPersonality.onCellAppData and BWPersonality.onDelCellAppData.

NOTE: Only top-level values are propagated, if you have a value that is mutable (for example, a list) and it changed internally (for example, changing just one member), this information is NOT propagated.

Do NOT do the following:
BigWorld.cellAppData[ "list" ] = [1, 2, 3]
BigWorld.cellAppData[ "list" ][1] = 7
Locally, this would look like [1, 7, 3] and remotely [1, 2, 3].

component

This is the component that is executing the present python environment. Possible values are (so far) 'cell', 'base', 'client', 'database', 'bot' and 'editor'.

entities

Type:
PyEntities

globalData

For example:
BigWorld.globalData[ "hello" ] = "there"

Another CellApp or BaseApp can access this as follows:
print BigWorld.globalData[ "hello" ]

The key and value can be any type that can be pickled and unpickled on all destination components.

When a value is changed or deleted, a callback function is called on all components. See: BWPersonality.onGlobalData and BWPersonality.onDelGlobalData.

NOTE: Only top-level values are propagated, if you have a value that is mutable (for example, a list) and it changed internally (for example, changing just one member), this information is NOT propagated.

Do NOT do the following:
BigWorld.globalData[ "list" ] = [1, 2, 3]
BigWorld.globalData[ "list" ][1] = 7
Locally, this would look like [1, 7, 3] and remotely [1, 2, 3].


Math - BigWorld cell Documentation

Math Module Reference

This module contains factory methods for the various maths related BigWorld objects.

Class List

Matrix
MatrixInverse
MatrixProduct
MatrixProvider
Plane
Vector2
Vector3
Vector4
Vector4Animation
Vector4Basic
Vector4Combiner
Vector4Distance
Vector4LFO
Vector4MatrixAdaptor
Vector4Morph
Vector4Product
Vector4Provider
Vector4Shader
Vector4Swizzle
Vector4Translation

Member Functions

def Matrix( matProv ):
def MatrixInverse( ):
def MatrixProduct( ):
def Plane( ):
def Vector2( ):
def Vector3( ):
def Vector4( ):
def Vector4Animation( ):
def Vector4Combiner( ):
def Vector4Distance( ):
def Vector4LFO( ):
def Vector4MatrixAdaptor( ):
def Vector4Morph( ):
def Vector4Product( ):
def Vector4Shader( ):
def Vector4Swizzle( ):
def Vector4Translation( ):
def getRegister( register ):

Member Function Documentation

def Matrix( matProv ):

This function creates a new Matrix. It can take either none or one arguments. If it takes none, it creates a zero matrix. If it takes one argument, then that must be a MatrixProvider, at which point this matrix is set to the matrix contained in the MatrixProvider at the time of the function call.

Parameters:
matProv an optional MatrixProvider, which this matrix is set to.

Returns:
a new Matrix

def MatrixInverse( ):

def MatrixProduct( ):

def Plane( ):

This function creates a new Plane.

Returns:
a new Plane

def Vector2( ):

This function creates a Vector with 2 elements. It can either take 2 floats, or a single float which is applied to both components.

Returns:
the newly created Vector2.

def Vector3( ):

This function creates a Vector with 3 elements. It can either take 3 floats, or a single float which is applied to all components.

Returns:
the newly created Vector3.

def Vector4( ):

This function creates a Vector with 4 elements. It can either take 4 floats, or a single float which is applied to all components.

Returns:
the newly created Vector4.

def Vector4Animation( ):

Returns:
The new Vector4Animation

def Vector4Combiner( ):

def Vector4Distance( ):

Returns:
The new Vector4Distance

def Vector4LFO( ):

Returns:
The new Vector4LFO

def Vector4MatrixAdaptor( ):

def Vector4Morph( ):

Returns:
The new Vector4Morph

def Vector4Product( ):

Returns:
The new Vector4Product

def Vector4Shader( ):

def Vector4Swizzle( ):

def Vector4Translation( ):

Returns:
The new Vector4Translation

def getRegister( register ):

This method provides a python interface to retrieve references to temporary registers. The value is returned as a Vector4ProviderPtr, so the register can also be updated by changing the returned value.

Parameters:
register The temporary register to access as an int (eg, 1-16)

Returns:
A Vector4ProviderPtr containing the contents of the given register


ResMgr - BigWorld cell Documentation

ResMgr Module Reference

Class List

DataSection

Member Functions

def DataSection( sectionName ):
def isDir( pathname ):
def isFile( pathname ):
def localise( string, params ):
def openSection( resourceID, newSection ):
def purge( resourceID, recurse ):
def resolveToAbsolutePath( ):
def save( resourceID ):

Attributes

root DataSection

Member Function Documentation

def DataSection( sectionName ):

This module function constructs a blank data section. It can be optionally supplied with a new name. This DataSection will not be savable using the save function, as it has no file system association.

Parameters:
sectionName Optional name for the new section

Returns:
the section that was created

def isDir( pathname ):

This function returns true if the specified path name is a directory, false otherwise.

Parameters:
pathname The path name to check.

Returns:
True (1) if it is a directory, false (0) otherwise.

def isFile( pathname ):

This function returns true if the specified path name is a file, false otherwise.

Parameters:
pathname The path name to check.

Returns:
True (1) if it is a file, false (0) otherwise.

def localise( string, params ):

This function localises a string and expand its params

Parameters:
string | The string to localise
params | The params used to expand

Returns:
localised and expanded string

def openSection( resourceID, newSection ):

This function opens the specified resource as a DataSection. If the resource is not found, then it returns None. A new section can optionally be created by specifying true in the optional second argument.

Resources live in a res tree and include directories, xml files, xml nodes, normal data files, binary section data file nodes, etc.

Parameters:
resourceID | the id of the resource to open.
newSection | Boolean value indicating whether to create this as a new section, default is False.

Returns:
the DataSection that was loaded, or None if the id was not found.

def purge( resourceID, recurse ):

This function purges the previously loaded section with the specified path from the cache and census. Optionally, all child sections can also be purged (only useful if the resource is a DirSection), by specifying true in the optional second argument.

Parameters:
resourceID | the id of the resource to purge.
recurse | Boolean value indicating whether to recursively purge any subsections. default is False.

def resolveToAbsolutePath( ):

This function resolves a path relative to the res tree to an absolute path. If the file does not exist in any of the resource paths, then it will be resolved against the first resource path.

Returns:
The absolute path

def save( resourceID ):

This function saves the previously loaded section with the specified path. If no section with that id is still in memory, then an IO error occurs, otherwise, the section is saved.

Parameters:
resourceID the filepath of the DataSection to save.

Returns:
True if successful, False otherwise.

Attribute Documentation

root

This is the root data section of the resource tree.

Type:
DataSection


BaseEntityMailBox - BigWorld cell Documentation

BaseEntityMailBox Class Reference

BaseEntityMailBox is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

CommonBaseEntityMailBox → ServerEntityMailBox → PyEntityMailBox → PyObjectPlus

Attributes

cell
client
ownClient

Detailed Description

BaseEntityMailBox inherits from ServerEntityMailBox.

A BaseEntityMailBox is used by a Cell Entity to communicate with its associated Base Entity. This allows the Cell Entity to call the methods on the Base Entity.

For example:

self.base.baseMethod()

where baseMethod() is described in the .def file.

Attribute Documentation

cell

For example, to call the cell methods via a base mailbox 'baseMB', use:

baseMB.cell.cellMethod()

The method call will first be sent to the base this mailbox belongs to and then redirected to the cell counterpart.

client

For example, to call the client methods via a base mailbox 'baseMB', use:

baseMB.client.clientMethod()

The method call will first be sent to the base this mailbox belongs to and then redirected to the client counterpart.

ownClient


BaseViaCellMailBox - BigWorld cell Documentation

BaseViaCellMailBox Class Reference

BaseViaCellMailBox is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

CellEntityMailBox → ServerEntityMailBox → PyEntityMailBox → PyObjectPlus

Detailed Description

BaseViaCellMailBox inherits from CellEntityMailBox.

A BaseViaCellMailBox is used to communicate with a Cell entity's associated Base entity with communication passing through the Cell entity. This kind of mailbox may be returned when referencing another Cell entity through a mailbox, and then requesting it's Base mailbox.

The BaseViaCellMailBox is used as an optimisation within BigWorld to avoid having to perform a Base entity lookup from the calling entity.

These mailboxes have the same restrictions as Cell mailboxes and should not be stored, they should be used immediately then discarded.


CellEntityMailBox - BigWorld cell Documentation

CellEntityMailBox Class Reference

CellEntityMailBox is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

ServerEntityMailBox → PyEntityMailBox → PyObjectPlus

Attributes

base
client
ownClient

Detailed Description

CellEntityMailBox inherits from ServerEntityMailBox.

On a Cell, the CellEntityMailBox is used in a variety of functions to determine Space or locational information.

For example, to teleport an NPC to another Entity in a different Space:

self.teleport( otherEntity.cell, otherEntity.position, otherEntity.direction )

Attribute Documentation

base

cellMB.base.baseMethod()

The method call will first be sent to the cell this mailbox belongs to and then redirected to the base counterpart.

client

cellMB.client.clientMethod()

The method call will first be sent to the cell this mailbox belongs to and then redirected to the client counterpart.

You can only call the methods on own client.

ownClient


CellViaBaseMailBox - BigWorld cell Documentation

CellViaBaseMailBox Class Reference

CellViaBaseMailBox is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

CommonBaseEntityMailBox → ServerEntityMailBox → PyEntityMailBox → PyObjectPlus

Detailed Description

CellViaBaseMailBox inherits from BaseEntityMailBox.

A CellViaBaseMailBox is used to communicate with a Cell entity channeling the communication through the associated Base entity. This may occur when a Cell entity, entity A, has another Cell entity's, entity B, associated Base mailbox and uses this mailbox to reference the associated Cell entity. For example:

class EntityA( ... ): ...

def example( self ): ... entityB_BaseMailbox.cell.doSomething()

It is important to note that there are some BigWorld methods that will not accept a CellViaBaseMailbox in place of a regular cell mailbox. For an example of how to work around this issue, please refer to the BaseApp Python API documention for the Base.createCellEntity() method.

Unlike direct Cell entity mailboxes, these mailboxes may be stored and used later.


ClientCaller - BigWorld cell Documentation

ClientCaller Class Reference

ClientCaller is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

PyObjectPlus

Detailed Description

Instances of the ClientCaller class represent entity member functions which a cell application can call on one or more clients. When an object of this type is called it adds a request to call the appropriate function on to the network bundles that are sent to the appropriate clients.

ClientCaller objects cannot be created via python, and are available only through instances which are created by PyClient objects. Further information and an example regarding the use of ClientCaller objects can be found in the PyClient class documentation.


DataSection - BigWorld cell Documentation

DataSection Class Reference

[ResMgr Module]

DataSection is part of the ResMgr module. More...

import ResMgr

Member Functions

def child( self, index ):
def childName( self, index ):
def cleanName( self ):
def copy( self, source ):
def copyToZip( self ):
def createSection( self, sectionPath ):
def createSectionFromString( self, string ):
def deleteSection( self, section ):
def has_key( self, key ):
def isNameClean( self ):
def items( self ):
def keys( self ):
def readBlob( self, sectionName, defaultVal ):
def readBool( self, sectionName, defaultVal ):
def readFloat( self, sectionName, defaultVal ):
def readFloats( self, sectionName ):
def readInt( self, sectionName, defaultVal ):
def readInt64( self, sectionName, defaultVal ):
def readInts( self, sectionName ):
def readMatrix( self, sectionName, defaultVal ):
def readString( self, sectionName, defaultVal ):
def readStrings( self, sectionName ):
def readVector2( self, sectionName, defaultVal ):
def readVector2s( self, sectionName ):
def readVector3( self, sectionName, defaultVal ):
def readVector3s( self, sectionName ):
def readVector4( self, sectionName, defaultVal ):
def readVector4s( self, sectionName ):
def readWideString( self, sectionName, defaultVal ):
def readWideStrings( self, sectionName ):
def save( self ):
def values( self ):
def write( self, sectionName, value ):
def writeBlob( self, sectionName, text ):
def writeBool( self, sectionName, val ):
def writeFloat( self, sectionName, val ):
def writeFloats( self, sectionName, values ):
def writeInt( self, sectionName, val ):
def writeInt64( self, sectionName, val ):
def writeInts( self, sectionName, values ):
def writeMatrix( self, sectionName, val ):
def writeString( self, sectionName, text ):
def writeStrings( self, sectionName, values ):
def writeVector2( self, sectionName, val ):
def writeVector2s( self, sectionName, values ):
def writeVector3( self, sectionName, val ):
def writeVector3s( self, sectionName, values ):
def writeVector4( self, sectionName, val ):
def writeVector4s( self, sectionName, values ):
def writeWideString( self, sectionName, text ):
def writeWideStrings( self, sectionName, values ):

Attributes

asBinary | String
asBlob | String
asBool | Integer
asFloat | Float
asInt | Integer
asInt64 | Integer
asMatrix | Matrix
asString | String
asVector2 | Vector2
asVector3 | Vector3
asVector4 | Vector4
asWideString | Wide String
name | Read-Only String
name | Read-Only String

Detailed Description

A DataSection controls the reading and writing of xml data sections. New DataSections can be created via ResMgr. DataSection(). In this case section cannot be saved because it has no file system association. To open an existing DataSection, use ResMgr.openSection().

Member Function Documentation

def child( self, index ):

This method returns the child at the given index.

Parameters:
index the index to look up the child subsection at.

Returns:
the child at the specified index.

def childName( self, index ):

This method returns the name of the child at the given index.

Parameters:
index the index to look up the child subsection at.

Returns:
the child at the specified index.

def cleanName( self ):

This method cleans xml section names by replacing spaces with double periods and puts "id." in front of xml section names that begin with numbers.

Returns:
A boolean indicating that a change took place in the name.

def copy( self, source ):

This function makes this DataSection into a copy of the specified DataSection.

Parameters:
source the section to copy this one from.

def copyToZip( self ):

This function makes takes this DataSection and copies it into a new DataSection as well as converting it to a zip if possible.

Returns:
A 2-tuple with the new data section and a boolean to indicate if the conversion was successful.

def createSection( self, sectionPath ):

This method creates the section specified by the input path, as a subsection of the parent. It will always create a new subsection, even if a section of the same name already exists. The path can contain slashes, which will allow for the creation of subsection within subsection. The path will be evaluated through the first section that has that name, and, if the whole path already exists, only the innermost section will be duplicated.

For example, if ds represents the following piece of xml:

    <red>
        <green>
            <blue></blue>
        </green>
    </red>
    <red>
        <green>
            <blue></blue>
        </green>
    </red>

and then the following code is executed:

ds.createSection( "red/green/blue" )

then the following will be the resultant xml represented by ds:

    <red>
        <green>
            <blue></blue>
            <blue></blue>
        </green>
    </red>
    <red>
        <green>
            <blue></blue>
        </green>
    </red>

Parameters:
sectionPath the path to the section to create.

Returns:
the DataSection that was created.

def createSectionFromString( self, string ):

This method creates the section represented by the input string, as a subsection of the parent.

For example, if ds represents the following piece of xml:

    <red>
        <green>
            <blue></blue>
        </green>
    </red>

and then the following code is executed:

string = "<red><green><blue></blue></green></red>"
ds.createSectionFromString( string )

then the following will be the resultant xml represented by ds:

    <red>
        <green>
            <blue></blue>
        </green>
    </red>
    <red>
        <green>
            <blue></blue>
        </green>
    </red>

Parameters:
string the xml string to create the section from.

Returns:
the DataSection that was created.

def deleteSection( self, section ):

This method deletes a section referenced either by a PyDataSection or an input string path. in the case of input string path,if more than one section is addressed by the path, then only the first one is deleted. It returns 1 if the section was successfully deleted, 0 otherwise.

Parameters:
section can be either a PyDataSection or a string path of the section to delete

Returns:
1 if it was deleted, 0 otherwise.

def has_key( self, key ):

This method checks if one of the subsections within this data section has the specified name, and returns 1 if it does, 0 otherwise.

Parameters:
key A string containing the name of the section to check for.

Returns:
An integer: 1 if the section exists, 0 otherwise.

def isNameClean( self ):

This method returns whether the section name is valid. XML can be a little more strict about allowed names.

Returns:
A boolean indicating whether the name is clean.

def items( self ):

Returns:
The list of (name, DataSection) tuples of this section's children.

def keys( self ):

This method returns a list of all the subsection names, in the order in which they appear in the xml code.

Returns:
The list of the names (strings)

def readBlob( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified, interpreted as a Blob string. It performs a trim (drop off leading and trailing white space) on the text immediately following the opening tag, and preceding the first open tag for a subsection.

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the string from.
defaultVal | the default value should an error occur.

Returns:
the string contained in the specified section, or the default value (if specified), an empty string otherwise.

def readBool( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified, parsed as a boolean.

If it contains the string "true", with any capitalisation, then it returns 1, otherwise, it returns 0.

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the boolean from.
defaultVal | the default value should an error occur.

Returns:
the boolean (integer) contained in the specified section, or the default value (if specified), false otherwise.

def readFloat( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified parsed as a floating point number.

It performs a trim (drop off leading and trailing white space) on the text immediately following the opening tag, and preceding the first open tag for a subsection. It tries to parse a float at the front of the resulting string, returning the integer if the parse succeeds, 0 otherwise.

If the sectionName specified doesn't match any sections, then 0 is returned.

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the float from.
defaultVal | the default value should an error occur.

Returns:
the float contained in the specified section, or the default value (if specified), 0 otherwise.

def readFloats( self, sectionName ):

This function reads the contents of any subsections of the current section with the specified name, and returns the results as tuple of floats. It tries to parse the contents of each subsection as a float, using that float if the parse is sucessful, otherwise 0.

Parameters:
sectionName the name of the subsections from which floats will be parsed.

Returns:
a tuple of the floats from the named subsections.

def readInt( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified parsed as an integer.

It performs a trim (drop off leading and trailing white space) on the text immediately following the opening tag, and preceding the first open tag for a subsection. It tries to parse an integer at the front of the resulting string, returning the integer if the parse succeeds, 0 otherwise.

If the sectionName specified doesn't match any sections, then 0 is returned.

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the int from.
defaultVal | the default value should an error occur.

Returns:
the int contained in the specified section, or the default value (if specified), 0 otherwise.

def readInt64( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified parsed as an integer.

It performs a trim (drop off leading and trailing white space) on the text immediately following the opening tag, and preceding the first open tag for a subsection. It tries to parse an integer at the front of the resulting string, returning the integer if the parse succeeds, 0 otherwise.

If the sectionName specified doesn't match any sections, then 0 is returned.

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the int from.
defaultVal | the default value should an error occur.

Returns:
the int contained in the specified section, or the default value (if specified), 0 otherwise.

def readInts( self, sectionName ):

This function reads the contents of any subsections of the current section with the specified name, and returns the results as tuple of integers. It tries to parse the contents of each subsection as an integer, using that integer if the parse is sucessful, otherwise 0.

Parameters:
sectionName the name of the subsections from which integers will be parsed.

Returns:
a tuple of the integers from the named subsections.

def readMatrix( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified parsed as a Matrix.

It expects there there to be four subsections, called <row0>, <row1>, <row2> and <row3>. Each of these should have three floats separated by white space. If these conditions are met, a Matrix will be read in from the four rows otherwise, a Matrix with all zeros will be created.

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the Matrix from.
defaultVal | the default value should an error occur.

Returns:
the Matrix contained in the specified section, or the default value (if specified), a Null Matrix otherwise.

def readString( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified, interpreted as a string. It performs a trim (drop off leading and trailing white space) on the text immediately following the opening tag, and preceding the first open tag for a subsection.

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the string from.
defaultVal | the default value should an error occur.

Returns:
the string contained in the specified section, or the default value (if specified), an empty string otherwise.

def readStrings( self, sectionName ):

This function reads the contents of any subsections of the current section with the specified name, and returns the results as tuple of strings.

Parameters:
sectionName the name of the subsections from which strings will be extracted.

Returns:
a tuple of the strings from the named subsections.

def readVector2( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified parsed as a Vector2.

It expects two floating point numbers, separated by white space, at the beginning of the text for the named section. Any trailing text is ignored. If it gets this, it returns the two floats as a Vector2, otherwise it returns (0, 0).

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the Vector2 from.
defaultVal | the default value should an error occur.

Returns:
the Vector2 contained in the specified section, or the default value (if specified), (0, 0) otherwise.

def readVector2s( self, sectionName ):

This function reads the contents of any subsections of the current section with the specified name, and returns the results as tuple of Vector2s. It tries to parse the contents of each subsection as two floats, separated by whitespace. If the parse is successful, then these two floats are interepreted as a Vector2 and added to the tupple, otherwise the Vector2 (0,0) is used instead.

Parameters:
sectionName the name of the subsections from which Vector2s will be parsed.

Returns:
a tuple of the Vector2s from the named subsections.

def readVector3( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified parsed as a Vector3.

It expects three floating point numbers, separated by white space, at the beginning of the text for the named section. Any trailing text is ignored. If it gets this, it returns the three floats as a Vector3, otherwise it returns (0, 0, 0).

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the Vector3 from.
defaultVal | the default value should an error occur.

Returns:
the Vector3 contained in the specified section, or the default value (if specified), (0, 0, 0) otherwise.

def readVector3s( self, sectionName ):

This function reads the contents of any subsections of the current section with the specified name, and returns the results as tuple of Vector3s. It tries to parse the contents of each subsection as three floats, separated by whitespace. If the parse is successful, then these three floats are interepreted as a Vector3 and added to the tupple, otherwise the Vector3 (0,0,0) is used instead.

Parameters:
sectionName the name of the subsections from which Vector3s will be parsed.

Returns:
a tuple of the Vector3s from the named subsections.

def readVector4( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified parsed as a Vector4.

It expects four floating point numbers, separated by white space, at the beginning of the text for the named section. Any trailing text is ignored. If it gets this, it returns the four floats as a Vector4, otherwise it returns (0, 0, 0, 0).

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the Vector4 from.
defaultVal | the default value should an error occur.

Returns:
the Vector4 contained in the specified section, or the default value (if specified), (0, 0, 0, 0) otherwise.

def readVector4s( self, sectionName ):

This function reads the contents of any subsections of the current section with the specified name, and returns the results as tuple of Vector4s. It tries to parse the contents of each subsection as four floats, separated by whitespace. If the parse is successful, then these four floats are interepreted as a Vector4 and added to the tupple, otherwise the Vector4 (0,0,0,0) is used instead.

Parameters:
sectionName the name of the subsections from which Vector4s will be parsed.

Returns:
a tuple of the Vector4s from the named subsections.

def readWideString( self, sectionName, defaultVal ):

This function returns the contents of the section with the name specified, assuming that the contents are a wide string. It performs a trim (drop off leading and trailing white space) on the text immediately following the opening tag, and preceding the first open tag for a subsection.

Most wide strings in text xml files are encoded as base64. However, you can create readable wide strings in xml by hand, simply by prefixing a standard ascii string with an exclamation mark.

If there is more than one section with the specified name, then only the first one is used.

Parameters:
sectionName | the name of the section to get the wide string from.
defaultVal | the default value should an error occur.

Returns:
the string contained in the specified section, or the default value (if specified), an empty string otherwise.

def readWideStrings( self, sectionName ):

This function reads the contents of any subsections of the current section with the specified name, and returns the results as tuple of wide strings. It assumes that the contents of those subsections were in wide string format.

Most wide strings in text xml files are encoded as base64. However, you can create readable wide strings in xml by hand, simply by prefixing a standard ascii string with an exclamation mark.

Parameters:
sectionName the name of the subsections from which wide strings will be extracted.

Returns:
a tuple of the wide strings from the named subsections.

def save( self ):

This method saves the data section back to its underlying file. If called on a DataSection which does not correspond to a file, then it causes an IO error.

def values( self ):

This method returns a list of all child sections, in the order in which they appear in the XML.

Returns:
a list of DataSections

def write( self, sectionName, value ):

This function writes a subsection with the specified name. It creates the section if it does not already exist. If one or more sections of that name already exist, then it modifies the first one. It writes whatever value it was given as its second argument as the contents for the named section.

Parameters:
sectionName | the name of the subsection to write to.
value | the value to write to the named section.

Returns:
the DataSection that was written to.

def writeBlob( self, sectionName, text ):

This function writes a subsection with the specified name, writing the specified BLOB string. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified string. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
text | the text to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeBool( self, sectionName, val ):

This function writes a subsection with the specified name, writing the specified integer as a string. If the integer is zero, 'false' is written, otherwise 'true'. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified boolean. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
val | the integer to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeFloat( self, sectionName, val ):

This function writes a subsection with the specified name, writing the specified float as a string. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified float. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
val | the float to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeFloats( self, sectionName, values ):

This function creates a subsection of the specified name for each element of the supplied sequence, writing the corresponding float from the sequence as the contents of that subsection.

For example, the following statement:

ds.writeInts( "sect", ( 123.4, 456.7 ) )

would result in the generation of the following xml

    <sect> 123.4 </sect>
    <sect> 456.7 </sect>

This function has no effect on existing subsections of the same name. A new subsection is always created for each element in the sequence.

Parameters:
sectionName | the name of the subsection to create.
values | the sequence of floats to use as values for the new subsections.

def writeInt( self, sectionName, val ):

This function writes a subsection with the specified name, writing the specified integer as a string. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified integer. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
val | the integer to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeInt64( self, sectionName, val ):

This function writes a subsection with the specified name, writing the specified 64-bit integer. If one or more subsections with that name alreadycl exist, then the value of the first one is replaced with the specified value. This will not affect any subsections of the named * subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
val | the integer to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeInts( self, sectionName, values ):

This function creates a subsection of the specified name for each element of the supplied sequence, writing the corresponding integer from the sequence as the contents of that subsection.

For example, the following statement:

ds.writeInts( "sect", ( 123, 456 ) )

would result in the generation of the following xml

    <sect> 123 </sect>
    <sect> 456 </sect>

This function has no effect on existing subsections of the same name. A new subsection is always created for each element in the sequence.

Parameters:
sectionName | the name of the subsection to create.
values | the sequence of integers to use as values for the new subsections.

def writeMatrix( self, sectionName, val ):

This function writes a subsection with the specified name, writing the specified Matrix. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified value. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
val | the Matrix to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeString( self, sectionName, text ):

This function writes a subsection with the specified name, writing the specified string. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified string. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
text | the text to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeStrings( self, sectionName, values ):

This function creates a subsection of the specified name for each element of the supplied list, writing the corresponding string from the list as the contents of that subsection.

For example, the following statement:

ds.writeStrings( "sect", ( "str1", "str2" ) )

would result in the generation of the following xml:

    <sect> str1 </sect>
    <sect> str2 </sect>

This function has no effect on existing subsections of the same name. A new subsection is always created for each list element.

Parameters:
sectionName | the name of the subsection to create.
values | the list of strings to use as values for the new subsections.

def writeVector2( self, sectionName, val ):

This function writes a subsection with the specified name, writing the specified Vector2 as a string, consisting of two floats, separated by white space. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified Vector2. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
val | the Vector2 to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeVector2s( self, sectionName, values ):

This function creates a subsection of the specified name for each element of the supplied sequence, writing the corresponding Vector2 from the sequence as the contents of that subsection.

For example, the following statement:

ds.writeVector2s( "sect", ( (1.1, 2.2) , (3.3, 4.4) ) )

would result in the generation of the following xml

    <sect> 1.100000 2.200000 </sect>
    <sect> 3.300000 4.400000 </sect>

This function has no effect on existing subsections of the same name. A new subsection is always created for each element in the sequence.

Parameters:
sectionName | the name of the subsection to create.
values | the sequence of Vector2s to use as values for the new subsections.

def writeVector3( self, sectionName, val ):

This function writes a subsection with the specified name, writing the specified Vector3 as a string, consisting of three floats, separated by white space. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified Vector3. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
val | the Vector3 to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeVector3s( self, sectionName, values ):

This function creates a subsection of the specified name for each element of the supplied sequence, writing the corresponding Vector3 from the sequence as the contents of that subsection.

For example, the following statement:

ds.writeVector3s( "sect", ( (1.1, 2.2, 3.3) , (3.3, 4.4, 5.5) ) )

would result in the generation of the following xml

    <sect> 1.100000 2.200000 3.300000 </sect>
    <sect> 3.300000 4.400000 5.500000 </sect>

This function has no effect on existing subsections of the same name. A new subsection is always created for each element in the sequence.

Parameters:
sectionName | the name of the subsection to create.
values | the sequence of Vector3s to use as values for the new subsections.

def writeVector4( self, sectionName, val ):

This function writes a subsection with the specified name, writing the specified Vector4 as a string, consisting of four floats, separated by white space. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified Vector4. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
val | the Vector4 to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeVector4s( self, sectionName, values ):

This function creates a subsection of the specified name for each element of the supplied sequence, writing the corresponding Vector4 from the sequence as the contents of that subsection.

For example, the following statement:

ds.writeVector3s( "sect", ( (1.1, 2.2, 3.3, 4.4) , (3.3, 4.4, 5.5, 6.6) ) )

would result in the generation of the following xml

    <sect> 1.100000 2.200000 3.300000 4.400000 </sect>
    <sect> 3.300000 4.400000 5.500000 6.600000 </sect>

This function has no effect on existing subsections of the same name. A new subsection is always created for each element in the sequence.

Parameters:
sectionName | the name of the subsection to create.
values | the sequence of Vector4s to use as values for the new subsections.

def writeWideString( self, sectionName, text ):

This function writes a subsection with the specified name, writing the specified wide string. If one or more subsections with that name already exist, then the value of the first one is replaced with the specified wide string. This will not effect any subsections of the named subsection, only its actual contents.

Parameters:
sectionName | the name of the subsection to create or overwrite.
text | the text to replace the subsection contents with.

Returns:
the DataSection that was written to.

def writeWideStrings( self, sectionName, values ):

This function creates a subsection of the specified name for each element of the supplied list, writing the corresponding wide string from the list as the contents of that subsection.

This function has no effect on existing subsections of the same name. A new subsection is always created for each list element.

Parameters:
sectionName | the name of the subsection to create.
values | the list of wide strings to use as values for the new subsections.

Attribute Documentation

asBinary

This attribute is the underlying binary data of this DataSection, encapsulated in a string. On reading, it includes all the child sections. On writing, it may invalidate previously accessed child sections. Use with care. It is better to use the 'copy' method to copy DataSections around than to use this attribute.

Type:
String

asBlob

This attribute is the value of this DataSection, interpreted as a BASE64 string. When reading it, it doesn't include any of the child sections. Also on reading, the leading and trailing white space is trimmed off the string. On writing, it doesn't effect any of the child nodes.

Type:
String

asBool

This attribute is the value of this DataSection, interpreted as a boolean.

On reading, if the text contains "true" in any capitalisation, it returns 1, otherwise it returns 0.

On writing, if it is given a 0, it writes "false" otherwise it writes "true".

Type:
Integer

asFloat

This attribute is the value of this DataSection, interpreted as an float. On reading, it reads the string from the top level, and tries to parse a float off the front of it. If this is successful, the float is returned, otherwise zero.

On writing, it doesn't effect any of the child nodes, but replaces the top level string with the string version of the float.

Type:
Float

asInt

This attribute is the value of this DataSection, interpreted as an integer. On reading, it reads the string from the top level, and tries to parse an integer off the front of it. If this is successful, the integer is returned, otherwise zero.

On writing, it doesn't effect any of the child nodes, but replaces the top level string with the string version of the integer.

Type:
Integer

asInt64

This attribute is the value of this DataSection, interpreted as a 64 bit integer. On reading, it reads the string from the top level and tries to parse an integer off the front of it. If this is successful, the integer is returned, otherwise zero.

On writing, it doesn't effect any of the child nodes, but replaces the top level string with the string version of the integer.

Type:
Integer

asMatrix

This attribute is the value of this DataSection, interpreted as a Matrix.

On reading, it checks for four sub-sections, called , , and . If each of these exist and contain three floats separated by whitespace, then they are interpreted as the four rows of a Matrix, which is created and returned. Otherwise, the Matrix of all zeros is returned.

On Writing, it accepts a Matrix, and writes it out to the four sub-sections , , and , each of which will contain one row of the Matrix - three floats separated by white space. This will not effect any top level text stored in this DataSection.

Type:
Matrix

asString

This attribute is the value of this DataSection, interpreted as a string. When reading it, it doesn't include any of the child sections. Also on reading, the leading and trailing white space is trimmed off the string. On writing, it doesn't effect any of the child nodes.

Type:
String

asVector2

This attribute is the value of this DataSection, interpreted as a Vector2. On reading, it reads the string from the top level, and tries to parse it as two floats, separated by white space. If this is successful, the Vector2 of these floats is returned, otherwise the Vector2 (0,0).

On writing, it doesn't effect any of the child nodes, but replaces the top level string with the string version of the two components of the Vector2 as floats, separated by white space.

Type:
Vector2

asVector3

This attribute is the value of this DataSection, interpreted as a Vector3. On reading, it reads the string from the top level, and tries to parse it as three floats, separated by white space. If this is successful, the Vector3 of these floats is returned, otherwise the Vector3 (0,0,0).

On writing, it doesn't effect any of the child nodes, but replaces the top level string with the string version of the three components of the Vector3 as floats, separated by white space.

Type:
Vector3

asVector4

This attribute is the value of this DataSection, interpreted as a Vector4. On reading, it reads the string from the top level, and tries to parse it as four floats, separated by white space. If this is successful, the Vector4 of these floats is returned, otherwise the Vector4 (0,0,0,0).

On writing, it doesn't effect any of the child nodes, but replaces the top level string with the string version of the four components of the Vector4 as floats, separated by white space.

Type:
Vector4

asWideString

This attribute is the value of this DataSection, interpreted as a wide string. When reading it, it doesn't include any of the child sections. Also on reading, the leading and trailing white space is trimmed off the string. On writing, it doesn't effect any of the child nodes.

Type:
Wide String

name

This attribute is the name of the data section. It is read-only, and consists of the tag surrounding this particular section

Type:
Read-Only String

name

This attribute is the name of the data section. It is read-only, and consists of the tag surrounding this particular section

Type:
Read-Only String


Entity - BigWorld cell Documentation

Entity Class Reference

[BigWorld Module]

Entity is part of the BigWorld module. More...

import BigWorld

Parent Classes

PyObjectPlus

Member Functions

def accelerateAlongPath( self, waypoints, acceleration, maxSpeed, facing, userData ):
def accelerateToEntity( self, destinationEntity, acceleration, maxSpeed, range, facing, userData ):
def accelerateToPoint( self, destination, acceleration, maxSpeed, facing, userData ):
def addProximity( self, range, userArg ):
def addScanVision( self, angle, range, seeingHeight, amplitude, scanPeriod, phaseOffset, updatePeriod, userData ):
def addTimer( self, start, interval=0.0, userData=0 ):
def addVisibility( self, visibleHeight, userData ):
def addVision( self, angle, range, seeingHeight, period ):
def addYawRotator( self, targetYaw, velocity, userArg=0 ):
def alightVehicle( self ):
def boardVehicle( self, vehicleID ):
def canNavigateTo( self, destination, maxSearchDistance, girth ):
def cancel( self, controllerID ):
def clientEntity( self, destID ):
def debug( self ):
def destroy( self ):
def destroySpace( self ):
def dumpAoI( self ):
def entitiesInAoI( self, withheld ):
def entitiesInRange( self, range, entityType=None, position ):
def entitiesInView( self ):
def getAoIUpdateScheme( self, entity ):
def getDict( self ):
def getGroundPosition( self ):
def getStopPoint( self, destination, ignoreFirstStopPoint, maxSearchDistance, girth, stopDist, nearPortalDist ):
def isInAoI( self, entityOrID ):
def isReal( self ):
def isRealToScript( self ):
def isWithheldFromClient( self, entityOrID ):
def makeNoise( self, noiseLevel, event, info=0 ):
def moveToEntity( self, destEntityID, velocity, range, userData, faceMovement, moveVertically ):
def moveToPoint( self, destination, velocity, userData, faceMovement, moveVertically ):
def navigate( self, destination, velocity, faceMovement, maxSearchDistance, girth, closeEnough, userData ):
def navigateFollow( self, destEntity, angle, distance, velocity, maxMoveDistance, maxSearchDistance, faceMovement, girth, userData ):
def navigatePathPoints( self, destination, maxSearchDistance, girth ):
def navigateStep( self, destination, velocity, maxMoveDistance, maxSearchDistance, faceMovement, girth, userData ):
def setAoIRadius( self, radius, hyst=5 ):
def setAoIUpdateScheme( self, entity, scheme ):
def setPortalState( self, permissive, triFlags ):
def setVisionRange( self, visionAngle, range ):
def teleport( self, nearbyMBRef, position, direction ):
def trackEntity( self, entityID, velocity=2*pi, period=10, userArg=0 ):
def waySetPathLength( self ):
def withholdFromClient( self, entityOrID, isWithheld ):
def writeToDB( self ):

Callback Methods

def __init__( self, nearbyEntity ):
def onDestroy( self ):
def onEnterTrap( self, entity, range, controllerID, userArg ):
def onEnteredAoI( self, entity ):
def onEnteredCell( self ):
def onEnteringCell( self ):
def onGetWitness( self ):
def onGhostCreated( self ):
def onGhostDestroyed( self ):
def onLeaveTrap( self, entity, range, controllerID, userArg ):
def onLeaveTrapID( self, entityID, range, controllerID, userArg ):
def onLeavingCell( self ):
def onLeftAoI( self, entity ):
def onLeftAoIID( self, entityID ):
def onLeftCell( self ):
def onLoseControlledBy( self, id ):
def onLoseWitness( self ):
def onMove( self, controllerID, userData ):
def onMoveFailure( self, controllerID, userData ):
def onNavigate( self, controllerID, userData ):
def onNavigateFailed( self, controllerID, userData ):
def onNoise( self, entity, propRange, distance, event, info ):
def onPassengerAlightAttempt( self ):
def onPassengerBoardAttempt( self ):
def onRestore( self ):
def onSpaceGone( self ):
def onStartSeeing( self, entity, userData ):
def onStopSeeing( self, entity, userData ):
def onStopSeeingID( self, entityID, userData ):
def onTeleport( self ):
def onTeleportFailure( self ):
def onTeleportSuccess( self, nearbyEntity ):
def onTimer( self, timerHandle, userData ):
def onTurn( self, controllerID, userData ):
def onWindowOverflow( self ):
def onWitnessed( self, isWitnessed ):
def onWriteToDB( self ):

Attributes

allClients | Read-only PyClient
aoiUpdateScheme |
artificialLoad |
base | Read-only BaseEntityMailBox
canBeSeen | bool
className | Read-only string
client | Read-only PyClient
controlledBy | BaseEntityMailBox
debug_numTimesRealOffloaded |
direction | Tuple of 3 floats as (roll, pitch, yaw)
fieldOfView | float
hasWitness | boolean
id | Read-only Integer
isDestroyed | Read-only bool
isIndoors |
isOnGround | Read-write bool
isOutdoors |
isWitnessed |
localPitch | Read-only Float.
localPosition | Tuple of 3 floats as (x, y, z).
localRoll | Read-only Float.
localYaw | Read-only Float.
otherClients | Read-only PyClient
ownClient | Read-only PyClient
pitch | Read-only Float
position | Vector3
roll | Read-only Float
seeingHeight | float
shouldAutoBackup |
shouldDropVision | bool
spaceID | Read-only Integer.
stealthFactor | float
topSpeed | float
topSpeedY | float
vehicle | Entity
velocity | Read-only tuple of 3 floats, as (x, y, z)
visibleHeight | float
visionAngle | float
visionRange | float
volatileInfo | A sequence of 4 floats (or None objects)
yaw | Read-only Float

Detailed Description

Instances of the Entity class represent generic game objects on the cell. An Entity may be "real" or "ghosted", where a "ghost" Entity is a copy of of a "real" Entity that lives on an adjacent cell. For each entity there is one authoritative "real" Entity instance, and 0 or more "ghost" Entity instances which copy it.

An Entity instance handles the entity's positional data, including its space and rotation. It also controls how frequently (if ever) this data is sent to clients. Positional data can be altered by updates from an authoritative client, by controller objects, and by the teleport member function. Controllers are non-python objects that can be applied to cell entities to change their positional data over time. They are added to an Entity via member functions like "trackEntity" and "turnToYaw", and can be removed via "cancel".

Area of Interest, or "AoI" is an important concept for all BigWorld entities which belong to clients. The AoI of an entity is the area around it which the entity's client (if it has one) is aware of. This is used for culling the amount of data that the client is sent. The actual shape of an AoI is defined by a range of equal length on both the x and z axis, with a hysteresis area of similar shape extending out further. An Entity enters another Entity's AoI when it enters the AoI area, but doesn't leave it until it has moved outside the hysteresis area. An Entity can change its AoI size via "setAoIRadius". Entities within a particular distance can be found via "entitiesInRange", and changes to the set of entities within a given range can be observed via "addProximity".

The basis for a stealth system resides in Entity with noise event being handled by "makeNoise", and a movement noise handling system being accessible through "getStealthFactor" and "setStealthFactor".

A new Entity on a cellApp can be created using BigWorld.createEntity or BigWorld.createEntityFromFile function. An entity could also be spawned from remote baseApp BigWorld.createCellEntity function call.

An Entity can access the equivalent entity on base and client applications via a BaseEntityMailbox and a series of PyClient objects. These allow a set of function calls (which are specified in the entity's .def file) to be called remotely.

Member Function Documentation

def accelerateAlongPath( self, waypoints, acceleration, maxSpeed, facing, userData ):

This function moves the Entity through a series of given waypoints by applying an acceleration. For a given Entity only one movement controller can be active and so this function will replace any existing controller.

The notification methods are defined as follows:
    def onMove( self, controllerId, userData ):

The points inside the waypoints argument for accelerateAlongPath() are specified relative to the entity's local space, which may differ from global space if the entity is currently aboard a vehicle. If the entity is aboard a vehicle, and waypoints in global coordinates are desired, the entity should alight from the vehicle first before calling accelerateAlongPath().

See:
Entity.cancel

Parameters:
waypoints | ([Vector3]) The waypoints, in local space, to pass through.
acceleration | (float) The rate at which the entity will accelerate, in metres / second / second.
maxSpeed | (float) The maximum speed the entity will accelerate to.
facing | (optional int) Defines direction the entity should face while it moves. Should be one of: 0 Disabled 1 Face velocity (default) 2 Face acceleration
userData | (optional int) Data that will be passed to notification method.

Returns:
(int) The ID of the newly created controller.

def accelerateToEntity( self, destinationEntity, acceleration, maxSpeed, range, facing, userData ):

This function moves the entity towards the given target entity by applying an acceleration. For a given Entity only one movement controller can be active and so this function will replace any existing controller.

The notification methods are defined as follows;
    def onMove( self, controllerId, userData ):
    def onMoveFailure( self, controllerId, userData ):

See:
Entity.cancel

Parameters:
destinationEntity | (int) The ID of the entity to accelerate towards.
acceleration | (float) The rate at which the entity will accelerate, in metres / second / second.
maxSpeed | (float) The maximum speed the entity will accelerate to.
range | (float) Range within destination to stop.
facing | (optional int) Defines direction the entity should face while it moves. Should be one of: 0 Disabled 1 Face velocity (default) 2 Face acceleration
userData | (optional int) Data that will be passed to notification method.

Returns:
(int) The ID of the newly created controller.

def accelerateToPoint( self, destination, acceleration, maxSpeed, facing, userData ):

This function is equivalent to calling:
    entity.accelerateAlongPath( [destination], ... )

Similar to how accelerateAlongPath() treats the points inside the waypoints parameter, the destination parameter for accelerateToPoint() is specified relative to the entity's local space, which may differ from global space if the entity is currently aboard a vehicle. If the entity is aboard a vehicle, and a destination in global coordinates is desired, the entity should alight from the vehicle first before calling accelerateToPoint().

See:
Entity.accelerateAlongPath
Entity.cancel

Parameters:
destination | (Vector3) The destination to move to in local space.
acceleration | (float) The rate at which the entity will accelerate, in metres / second / second.
maxSpeed | (float) The maximum speed the entity will accelerate to.
facing | (optional int) Defines direction the entity should face while it moves. Valid values are: 0 Disabled 1 Face velocity (default) 2 Face acceleration
userData | (optional int) Data that will be passed to notification method.

Returns:
(int) The ID of the newly created controller.

def addProximity( self, range, userArg ):

Since the trap is a controller, use Entity.cancel with the controller ID to delete the trap.

Note that it is possible for the callbacks to be triggered immediately, even before the addProximity() call has returned.

See:
Entity.cancel

Parameters:
range | range is a float which gives the new size of the trap area. The range must be greater than or equal to 0.
userArg | userArg is an optional integer common to all controllers. This is only passed to the callbacks if the value is not 0. It is recommended to set a default value of 0 for userArg in the callback prototypes.

Returns:
addProximity returns the id of the created controller.

def addScanVision( self, angle, range, seeingHeight, amplitude, scanPeriod, phaseOffset, updatePeriod, userData ):

This function creates a controller that allows the Entity to scan left and right to (virtually) visualise other nearby Entities, invoking a notification method when an Entity becomes seen and not seen. For a given Entity, only one vision controller should be active at any one time. Returns a ControllerID that can be used to cancel() the 'vision'. The notification methods are not called when 'vision' is cancelled... The notification methods are defined as follows;

    def onStartSeeing( self, entityNowSeen ):
    def onStopSeeing( self, entityNoLongerSeen ):
    def onStopSeeingID( self, entityIDNoLongerSeen ):

See:
Entity.addVision
Entity.cancel

Parameters:
angle | (float) The angle of the vision cone in radians. The field of view is double this value.
range | (float) The range of the vision
seeingHeight | (float) The height on the Entity to use as the source of the field of view, eg, eye-level of current Model
amplitude | (float) The maximum yaw offset, in radians, that the entity scans. That is, the scan range is [yaw - amplitude, yaw + amplitude].
scanPeriod | (float) The time it takes to make each scan in seconds
phaseOffset | (float) Offset (phase) of the scan as a fraction.
updatePeriod | (optional int) How often the vision is updated in ticks (defaults to 1 == 1/10 sec)
userData | (optional object) Data that is passed to notification method

Returns:
(integer) The ID of the newly created controller

def addTimer( self, start, interval=0.0, userData=0 ):

A timer can be cancelled with Entity.cancel( controllerID ).

See:
Entity.cancel

Parameters:
start | Number of seconds until the first callback.
interval | Duration in seconds between subsequent callbacks. Set to zero for single timed event.
userData | userData is an optional integer to be passed to the onTimer function.

Returns:
The id of the newly created controller.

def addVisibility( self, visibleHeight, userData ):

See:
Entity.addVision
Entity.addScanVision
Entity.cancel

Parameters:
visibleHeight | visibleHeight is a float which gives the current height of the model.
userData | userData is not used in this controller.

Returns:
The id of the created controller.

def addVision( self, angle, range, seeingHeight, period ):

This function creates a controller that allows the Entity to (virtually) visualise other nearby Entities that have their Entity.canBeSeen attribute set to True, invoking a notification method when an Entity becomes seen and not seen. For a given Entity, only one vision controller should be active at any one time. Returns a ControllerID that can be used to cancel() the 'vision'.

The notification methods are not called when 'vision' is cancelled... The notification methods are defined as follows;

    def onStartSeeing( self, entityNowSeen ):
    def onStopSeeing( self, entityNoLongerSeen ):
    def onStopSeeingID( self, entityIDNoLongerSeen ):

See:
Entity.canBeSeen
Entity.addScanVision
Entity.cancel

Parameters:
angle | (float) The angle of the vision cone in radians. The field of view is double this value.
range | (float) The range of the vision
seeingHeight | (float) The height on the Entity to use as the source of the field of view, eg, eye-level of current Model
period | (optional int) How often the vision is updated in ticks (defaults to 10 == 1 sec)

Returns:
(integer) The ID of the newly created controller

def addYawRotator( self, targetYaw, velocity, userArg=0 ):

See:
Entity.cancel

Parameters:
targetYaw | targetYaw is a float representing the yaw to which the entity is to be turned, in radians and world space.
velocity | velocity is a float specifying the rate at which the entity should turn, in radians per second.
userArg | userArg is an integer which is passed as the second parameter to onTurn.

Returns:
The ID of the new controller. This can later be used with the Entity's cancel function to remove the controller and stop the Entity from turning. Entity.cancel( "Movement" ) can also be used to stop this controller.

def alightVehicle( self ):

This function removes an NPC Entity as a passenger of its currently boarded vehicle. It should only be used for Entities controlled by a Cell, not Player Entities (see BigWorld.controlEntity() and Entity.physics.teleportVehicle() in the Client documentation). Any Entity can be used as a vehicle, eg, car, bus, moving platform, animal. The position and movement of the Entities are linked so they move in unison. The Model on the Client should support the animations required to board, alight from and ride the Entity, as necessary. AI Control can be transferred to the vehicle in script if required, or left with the another Entity (eg, inside bus as passenger) or the vehicle itself (eg, moving platform). An Entity may only use one vehicle at a time. However, many Entities can be a passenger of the same vehicle. If the vehicle is destroyed, all passengers will be forced to alight.

def boardVehicle( self, vehicleID ):

This function adds an NPC Entity as a passenger of the entity with the given ID. It should only be used for Entities controlled by a Cell, not Player Entities (see BigWorld.controlEntity() and Entity.physics.teleportVehicle() in the Client documentation).

Any Entity can be used as a vehicle, eg, car, bus, moving platform, animal. The position and movement of the Entities are linked so they move in unison. The Model on the Client should support the animations required to board, alight from and ride the Entity, as necessary.

AI Control can be transferred to the vehicle in script if required, or left with the another Entity (eg, inside bus as passenger) or the vehicle itself (eg, moving platform).

An Entity may only use one vehicle at a time. However, many Entities can be a passenger of the same vehicle. If the vehicle is destroyed, all passengers will be forced to alight.

This method raises a TypeError if the entity is not a real entity, or if an entity is attempting to board its own passenger.

This method raises a ValueError if the entity is already on a vehicle, or if the vehicleID refers to a non-existent entity.

Parameters:
vehicleID (entityID) ID of Entity to be used as a vehicle

def canNavigateTo( self, destination, maxSearchDistance, girth ):

This function uses the BigWorld navigation system to determine whether the Entity can move to the given destination. BigWorld can have several pre-generated navigation systems, each with a different girth (resulting in different navigation paths).

See:
Entity.cancel

Parameters:
destination | (Vector3) The destination point for the navigation test.
maxSearchDistance | (optional float) Maximum distance to search (default maxAoIRadius).
girth | (optional float) Which navigation girth to use for the test (defaults to 0.5).

Returns:
(Vector3) The closest position that the entity can navigate to, or None if no path is found.

def cancel( self, controllerID ):

Parameters:
controllerID controllerID is an integer which is the index of the controller to cancel. Alternatively, a string of an exclusive controller category can be passed to cancel the controller of that category. For example, only one movement/navigation controller can be active at once. This can be cancelled with entity.cancel( "Movement" ).

def clientEntity( self, destID ):

For example, playerEntity.clientEntity( buttonEntityID ).flash() will call the flash() method on the button entity only on this player's application. Any other player with the button in their AoI will not have this method called.

See:
Entity.ownClient
Entity.allClients
Entity.otherClients

Parameters:
destID destID is the ID number of the entity to which the new PyClient is to be associated.

Returns:
A PyClient for the specified entity.

def debug( self ):

Sample Output:
107.9 DEBUG: RangeListNode::debugX: me.PosX=-347.4982910, me=[Entity 16777218], prevX=[Head], nextX=[Entity 16777216]
107.9 DEBUG: RangeListNode::debugZ: me.PosZ=369.6944580, me=[Entity 16777218], prevZ=[Entity 16777216], nextZ=[Tail]

def destroy( self ):

def destroySpace( self ):

def dumpAoI( self ):

A sample message follows:
451.8 DEBUG: Dumping AoI for entity 1000. Seen = 2, Pending=0. AoIRadius =  5.000 AoIHyst = 50.000
451.8 DEBUG: 16777218 vut 0 lut 1 curpri 0.000000
451.8 DEBUG: 16778216 vut 0 lut 4 curpri 0.000000
451.8 DEBUG: Entities marked as left AoI for entity 1000. left= 2
451.8 DEBUG: Entity 16777218 left AoI
451.8 DEBUG: Entity 16778216 left AoI
The first line of this message tells us:
  • the data is for entity #1000
  • it is watching 2 entities in its AoI
  • there are 0 entities in its AoI for which the Entity's client is awaiting initial data
  • the AoI radius is 5.000
  • the AoI hysteresis area extends 50.000 beyond the AoI radius
The following set of lines provide information for each of the entities that the Entity is watching. In this example line 2 tells us:
  • the Entity is watching entity #16777218
  • the last volatile information update that the Entity's client received for #16777218 was its update #0
  • the last event that the client received for #16777218 was its event #1
  • in the Entity's AoI entity #16777218 currently has an update priority of 0.000000
The fourth line in this example tells us that there are two entities in the hysteresis area for entity #1000.

Each of the following lines each list one of the entities which is currently in the Entity's hysteresis area. Although these entities have left the AoI, they are still updated for the client.

def entitiesInAoI( self, withheld ):

This method returns a list of the entities in this entity's Area of Interest.

Examples:
self.entitiesInAoI() # All entities in AoI

self.entitiesInAoI( withheld = True ) # All entities in AoI being withheld

self.entitiesInAoI( withheld = False ) # All entities in AoI not being withheld

Parameters:
withheld The optional keyword argument indicates whether only the withheld entities or only the entities not withheld should be included. If this is not passed, all entities are included.

def entitiesInRange( self, range, entityType=None, position ):

Parameters:
range | range is the distance around this entity to search, as a float.
entityType | An optional string argument of entity type name that will be used in matching entities. If entityType is a valid class name then only entities of that class will be returned, otherwise all entities in range are returned.
position | An optional Vector3 argument to be used as the centre of the searching radius.

Returns:
A list of Entity objects that are within the given range.

def entitiesInView( self ):

This function returns a list of all the Entities that can be seen with the current field of view and vision range.

See:
Entity.addVision

Returns:
(list) List of Entities currently in view

def getAoIUpdateScheme( self, entity ):

getAoIUpdateScheme returns the scheme used by an entity in this entity's Area of Interest.

Parameters:
entity The entity (or entity id) that is in the AoI.

def getDict( self ):

This is a useful debugging method but should be avoided in production.

def getGroundPosition( self ):

Returns:
The position of the ground below the entity (or the entity itself, if no ground is found), expressed as 3 floats (x, y, z), in worldspace.

def getStopPoint( self, destination, ignoreFirstStopPoint, maxSearchDistance, girth, stopDist, nearPortalDist ):

Parameters:
destination | (Vector3) The final destination point for the Entity.
ignoreFirstStopPoint | (bool) Set to True to determine next stopping point past current stopping point, otherwise the current stopping point would get triggered again.
maxSearchDistance | (optional float) Set the max distance of search (default to maxAoIRadius metres).
girth | (optional float) Which navigation girth to use (defaults to 0.5).
stopDist | (optional float) Distance before portal to stop (default 1.5 metres).
nearPortalDist | (optional float) Distance back from portal that the entity should be to be considered next to model blocking portal (eg, door) (default 1.8 metres).

Returns:
(Vector3, bool) Returns None if the entity can't navigate to destination. Otherwise, returns the point stopDist back along the navigation path from the activated portal and True if it reached the destination, False otherwise.

def isInAoI( self, entityOrID ):

This method returns whether an entity is in the current entity's Area of Interest.

Parameters:
entityOrID An entity or entity ID to check.

def isReal( self ):

This method should be rarely used but can be helpful for debugging.

Returns:
(bool) True if the entity is real, False if it is not.

def isRealToScript( self ):

This method should be rarely used but can be helpful for debugging.

Returns:
(bool) True if the entity is real to script, otherwise False.

def isWithheldFromClient( self, entityOrID ):

This method returns whether an entity in the AoI is currently being withheld from being sent to the client. This is modified with Entity.withholdFromClient.

Parameters:
entityOrID An entity or entity ID to check

Returns:
True if currently withheld, otherwise false. If the entity does not exist, a ValueError is raised.

def makeNoise( self, noiseLevel, event, info=0 ):

It does this by calling the onNoise function of each of these entities. onNoise must take five arguments, and is not defined by default. Errors thrown by the attempt to call onNoise are silently ignored. The arguments with which onNoise is called are the ID of the entity which made the noise, the distance from the source entity at which the noise can still be heard (as a float), the distance at which the noise was heard (as a float), an integer indicating the event which caused the sound, and an arbitrary user supplied integer which can be used to provide more information.

The distance between entities for noise propagation purposes is calculated as the shortest route of travel via chunk portals. This means that, for instance, if two chunks represent long parallel corridors, then a noise made in one may not be heard by an entity standing close by in the other.

This function can only be called on a real entity, a TypeError is raised if this is not the case.

Parameters:
noiseLevel | The noiseLevel parameter is a float which is multiplied by the value found in server/bw.xml/cellApp/noise/standardRange to determine the maximum distance at which the noise can be heard.
event | The event argument is an integer which indicates the type of event that caused the sound. This is 0 for movement related noise (see setStealthFactor), and is otherwise unrestricted.
info | The info argument is optional, and can be used to supply further information regarding a sound to the entities which hear it, as an integer. This is used as the fifth argument in all calls to onNoise that this makes.

def moveToEntity( self, destEntityID, velocity, range, userData, faceMovement, moveVertically ):

This function moves the Entity in a straight line towards another Entity, invoking a notification method on success or failure. For a given Entity, only one navigation/movement controller is active at any one time. Returns a ControllerID that can be used to cancel the movement. For example, Entity.cancel( movementID ). Movement can also be led with Entity.cancel( "Movement" ). The notification methods are not called when movement is cancelled.

    def onMove( self, controllerId, userData ):
    def onMoveFailure( self, controllerId, userData ):

See:
Entity.cancel

Parameters:
destEntityID | (int) The ID of the target Entity.
velocity | (float) The speed to move the Entity in metres / second.
range | (float) Maxmimum range from destination to stop.
userData | (optional int) Data that can be passed to the notification method.
faceMovement | (optional bool) True if entity is to face in direction of movement (default). Should be False if another mechanism is to provide direction.
moveVertically | (optional bool) True if Entity is allowed to move vertically, that is, to fly. Set to false if Entity is to remain on ground (default).

Returns:
(int) The ID of the newly created controller.

def moveToPoint( self, destination, velocity, userData, faceMovement, moveVertically ):

This function moves the Entity in a straight line towards a given point, invoking a notification method on success or failure. For a given Entity, only one navigation/movement controller is active at any one time. Returns a ControllerID that can be used to cancel the movement. For example, Entity.cancel( movementID ). Movement can also be led with Entity.cancel( "Movement" ). The notification methods are not called when movement is cancelled.

The notification methods are defined as follows:
    def onMove( self, controllerId, userData ):

Note that the destination point is specified relative to the entity's local space, which may differ from global space if the entity is currently aboard a vehicle. If the entity is aboard a vehicle, and a destination in global coordinates is desired, the entity should alight from the vehicle first before calling moveToPoint().

See:
Entity.cancel

Parameters:
destination | (Vector3) The destination point for the Entity, in local space.
velocity | (float) The speed to move the Entity in metres / second.
userData | (optional int) Data that can be passed to notification method.
faceMovement | (optional bool) True if entity is to face in direction of movement (default). Should be False if another mechanism is to provide direction.
moveVertically | (optional bool) True if Entity is allowed to move vertically, that is, to fly. Set to false if Entity is to remain on ground (default).

Returns:
(int) The ID of the newly created controller.

def navigate( self, destination, velocity, faceMovement, maxSearchDistance, girth, closeEnough, userData ):

This function uses the BigWorld navigation system to move the Entity to a destination point, invoking a notification method on success or failure. BigWorld can have several pre-generated navigation systems, each with a different girth (resulting in different navigation paths). Currently we don't support an entity which is on a vehicle to navigate, if you want to do so, you have to alight the vehicle first, or do navigate on the vehicle entity. For a given Entity, only one navigation/movement controller can be active at any one time. Returns a ControllerID that can be used to cancel the movement. For example, Entity.cancel( movementID ). Movement can also be led with Entity.cancel( "Movement" ). The notification methods are not called when movement is cancelled.

The notification methods are defined as follows;
    def onNavigate( self, controllerId, userData ):
    def onNavigateFailed( self, controllerId, userData ):

See:
Entity.cancel

Parameters:
destination | (Vector3) The destination point for the entity.
velocity | (float) The speed to move the Entity in metres / second.
faceMovement | (optional bool) True if entity is to face in direction of movement (default). Should be False if another mechanism is to provide direction.
maxSearchDistance | (float) Maximum distance to search.
girth | (optional float) Which navigation girth to use (defaults to 0.5).
closeEnough | (optional float) Maximum distance from destination to stop. Note: A value of 0 should never be used.
userData | (optional int) Data that is passed to notification method.

Returns:
(int) The ID of the newly created controller

def navigateFollow( self, destEntity, angle, distance, velocity, maxMoveDistance, maxSearchDistance, faceMovement, girth, userData ):

This function uses the BigWorld navigation system to move the Entity towards another Entity, stopping at the next waypoint or given distance, invoking a notification method on success or failure.

BigWorld can have several pre-generated navigation systems, each with a different girth (resulting in different navigation paths). For a given Entity, only one navigation / movement controller is active at any one time.

Returns a ControllerID that can be used to cancel the movement. For example; Entity.cancel( movementID ). Movement can also be led with Entity.cancel( "Movement" ).

The notification method is not called when movement is cancelled.

The notification method is defined as follows;
    def onMove( self, controllerId, userData ):

See:
Entity.cancel

Parameters:
destEntity | (Entity) The target Entity
angle | (float) The angle at which the Entity should attempt to follow (in radians)
distance | (float) The distance at which the Entity should attempt to follow
velocity | (float) The speed to move the Entity in metres / second.
maxMoveDistance | (float) Maximum distance to move
maxSearchDistance | (optional float) The maximum search distance (default maxAoIRadius metres)
faceMovement | (optional bool) True if entity is to face in direction of movement (default). Should be False if another mechanism is to provide direction.
girth | (optional float) Which navigation girth to use (defaults to 0.5)
userData | (optional int) Data that can be passed to notification method

Returns:
(int) The ID of the newly created controller.

def navigatePathPoints( self, destination, maxSearchDistance, girth ):

This function returns the points along a path from this entity position to the given destination position.

Parameters:
destination | (Vector3) The destination point.
maxSearchDistance | (float) The maximum distance to search, in metres.
girth | (float) The navigation girth (defaults to 0.5).

def navigateStep( self, destination, velocity, maxMoveDistance, maxSearchDistance, faceMovement, girth, userData ):

This function uses the BigWorld navigation system to move the Entity towards a destination point, stopping at the next waypoint or given distance, invoking the onMove notification method on success.

When the Entity.onMove notification method is called, have it call Entity.navigateStep again to allow the entity to continue to move toward the target position.

If the Entity.onMove notification method calls Entity.navigateStep more than 100 times without moving the distance required for a single tick at the velocity specified, then the onMoveFailure notification method is invoked.

Currently BigWorld does not support using navigate methods on an entity which is on a vehicle. If you want to do so, you have to alight the vehicle first, or use the navigate methods on the vehicle entity.

For a given Entity, only one navigation/movement controller is active at any one time.

Returns a Controller ID that can be used to cancel the movement. For example:
    self.cancel( movementID )

Movement can also be cancelled with:
    self.cancel( "Movement" )

The notification method is not called when movement is cancelled.

The notification methods are defined as follows;
    def onMove( self, controllerId, userData ):
    def onMoveFailure( self, controllerId, userData ):

See:
Entity.cancel
Entity.onMove
Entity.onMoveFailure

Parameters:
destination | (Vector3) The destination point for the Entity to move towards.
velocity | (float) The speed to move the Entity in metres / second.
maxMoveDistance | (float) Maximum distance to move, in metres.
maxSearchDistance | (optional float) The maximum search distance (default maxAoIRadius metres)
faceMovement | (optional bool) True if entity is to face in direction of movement (default). Should be False if another mechanism is to provide direction.
girth | (optional float) Which navigation girth to use (defaults to 0.5).
userData | (optional int) Data that can be passed to notification method.

Returns:
(int) The ID of the newly created controller.

def setAoIRadius( self, radius, hyst=5 ):

This function is only available on the entity that has an associated witness.

By default an Entity's AoI area extends 500 metres along both the x and z axis of the world, and its hysteresis area extends another 5 metre further.

Note: If you set this to be greater than the bw.xml configuration option 'cellApp/maxAoIRadius', the AoI radius will be clamped to this value.

You can set the default AoI radius by setting the bw.xml configuration option 'cellApp/defaultAoIRadius'.

Parameters:
radius | radius specifies the size of the AoI area, as a float.
hyst | hyst specifies the size of the hysteresis area beyond the AoI area, as a float.

Returns:
None

def setAoIUpdateScheme( self, entity, scheme ):

setAoIUpdateScheme allows an entity in this entity's Area of Interest to have a specialised scheme for its update rate in that AoI.

When an entity enters another's AoI, the initial update scheme is taken from the viewed entity's Entity.aoiUpdateScheme property.

This value is reset if the entity leaves and then re-enters an AoI. If used, this would commonly appear in onEnteredAoI.

For example,
self.setAoIUpdateScheme( otherEntity, "sniper" )

Parameters:
entity | The entity (or entity id) that is in the AoI.
scheme | The name of the scheme to use. These are specified in the cellApp/aoiUpdateSchemes section of bw.xml

def setPortalState( self, permissive, triFlags ):

The position of the entity must be within 1 metre of the portal that is to be configured, otherwise the portal will probably not be found. No other portal may be closer.

Parameters:
permissive | Whether the portal is open or not.
triFlags | Optional argument that sets the flags on the portal's triangles as returned from collision tests.

def setVisionRange( self, visionAngle, range ):

This function alters the range and field of view of currently active vision controller.

A TypeError is raised if it is not called on a real entity and if the entity does not have a vision controller.

See:
Entity.addVision

Parameters:
visionAngle | (float) The angle of the vision cone in radians. The field of view is double this value.
range | (float) The new range of the vision

def teleport( self, nearbyMBRef, position, direction ):

Note that Entities which have a volatileInfo that does not allow transmission of position data will send their updated position to clients in an inefficient way. Care should be taken not to call this method continuously on a non-volatile entity.

The teleport function can only be called on real entities.

Parameters:
nearbyMBRef | A Mailbox that determines which Space and CellApp the Entity is teleporting to, as it is assumed to be near the teleport destination. This can be set to None, in which case it will remain on the current cell until cell migration occurs via normal means.
position | The position argument is the location to which the Entity is to be teleported, as a sequence of three floats (x, y, z), in world space.
direction | The direction argument is the direction to which the Entity is to be facing after the teleport, as a sequence of three floats ( roll, pitch, yaw), in world space.

Returns:
Always returns None.

def trackEntity( self, entityID, velocity=2*pi, period=10, userArg=0 ):

See:
Entity.cancel

Parameters:
entityID | The ID of the entity that this should turn towards. This entity must be known by the cell.
velocity | velocity is the speed at which the Entity will turn, in radians per second.
period | ticks ticks is the number of ticks that occur between updates. This affects how accurately the Entity will track its target.
userArg | userArg is an integer, and is not currently used.

Returns:
trackEntity returns the ID of the new controller. This can later be used with the Entity's cancel function to remove the controller and stop the Entity from tracking.

def waySetPathLength( self ):

Returns the length of the most recently determined navigation path, in chunks.

Returns:
(float) The length of the most recently determined navigation path.

def withholdFromClient( self, entityOrID, isWithheld ):

withholdFromClient allows an entity in an entity's Area of Interest to be withheld from being sent to the client.

This is often used with Entity.onEnteredAoI and Entity.entitiesInAoI.

Example:
# Identify and withhold entities that should be withheld.
def onEnteredAoI( self, entity ):
    if entity.shouldBeWithheldFrom( self ):
        self.withholdFromClient( entity, True )

# No longer withhold entities we now have the ability to send.
def adjustForExtraPowers( self ):
    for entity in self.entitiesInAoI( withheld = True ):
        if not entity.shouldBeWithheldFrom( self ):
            self.withholdFromClient( entity, False )

Parameters:
entityOrID | An entity or entity ID.
isWithheld | A boolean indicating whether the entity should be withheld. That is, it is not sent to the client.

Returns:
None. If the entity does not exist, a ValueError is raised.

def writeToDB( self ):

The cell entity's data is also backed up to the base entity to ensure that the fault tolerance data is at least as up-to-date as the disaster recovery data.

This method can only be called on a real entity that has a base entity.

Callback Method Documentation

def __init__( self, nearbyEntity ):

See:
Entity.onTeleportSuccess

Parameters:
nearbyEntity This optional argument accepts the entity that was used in the Base.createCellEntity call. This is useful for setting the initial position of the entity. This argument is guaranteed to be a real entity.

def onDestroy( self ):

def onEnterTrap( self, entity, range, controllerID, userArg ):

Parameters:
entity | The entity that has entered.
range | The range of the trigger.
controllerID | The id of the proximity trap controller.
userArg | If userArg is not 0, this is also passed to the callback. The prototype should assign a default value of 0 if it is possible that addProximity() can be called with a userArg value of 0.

def onEnteredAoI( self, entity ):

Note: Any persistent entity tracking performed as a result of this callback must be cleared in Entity.onRestore as the AoI is not restored during a CellApp failure.

See:
Entity.onLeftAoI
Entity.onLeftAoIID

Parameters:
entity The entity that entered the AoI.

def onEnteredCell( self ):

On the source cell, onLeavingCell is called on the real before it is offloaded. onLeftCell is then called on this entity after being converted to a ghost.

On the destination cell, onEnteringCell is called on the ghost entity. This ghost is then converted to a real entity and onEnteredCell is called.

Note: Think twice before using this callback. These can often be avoided by using smarter data types.

See:
Entity.onEnteringCell
Entity.onLeavingCell
Entity.onLeftCell

def onEnteringCell( self ):

On the source cell, onLeavingCell is called on the real before it is offloaded. onLeftCell is then called on this entity after being converted to a ghost.

On the destination cell, onEnteringCell is called on the ghost entity. This ghost is then converted to a real entity and onEnteredCell is called.

This method should be decorated with @bwdecorators.callableOnGhost since it will only be called on ghost entities.

Note: Think twice before using this callback. These can often be avoided by using smarter data types.

See:
Entity.onEnteredCell
Entity.onLeavingCell
Entity.onLeftCell

def onGetWitness( self ):

def onGhostCreated( self ):

Note: This callback must have the decorator @bwdecorators.callableOnGhost in order to be successfully called.

def onGhostDestroyed( self ):

Note: This callback must have the decorator @bwdecorators.callableOnGhost in order to be successfully called.

def onLeaveTrap( self, entity, range, controllerID, userArg ):

Parameters:
entity | The entity that has left.
range | The range of the trigger.
controllerID | The id of the proximity trap controller.
userArg | If userArg is not 0, this is also passed to the callback. The prototype should assign a default value of 0 if it is possible that addProximity() can be called with a userArg value of 0.

def onLeaveTrapID( self, entityID, range, controllerID, userArg ):

Parameters:
entityID | The id of the entity that has left.
range | The range of the trigger.
controllerID | The id of the proximity trap controller.
userArg | If userArg is not 0, this is also passed to the callback. The prototype should assign a default value of 0 if it is possible that addProximity() can be called with a userArg value of 0.

def onLeavingCell( self ):

On the source cell, onLeavingCell is called on the real before it is offloaded. onLeftCell is then called on this entity after being converted to a ghost.

On the destination cell, onEnteringCell is called on the ghost entity. This ghost is then converted to a real entity and onEnteredCell is called.

Note: Think twice before using this callback. These can often be avoided by using smarter data types.

See:
Entity.onEnteringCell
Entity.onEnteredCell
Entity.onLeftCell

def onLeftAoI( self, entity ):

NB: It is possible that the entity passed into this callback may already be destroyed, ie: entity.isDestroyed is True

See:
Entity.onEnteredAoI
Entity.onLeftAoIID

Parameters:
entity The entity that left the AoI.

def onLeftAoIID( self, entityID ):

See:
Entity.onEnteredAoI
Entity.onLeftAoI

Parameters:
entityID The ID of the entity that left the AoI.

def onLeftCell( self ):

On the source cell, onLeavingCell is called on the real before it is offloaded. onLeftCell is then called on this entity after being converted to a ghost.

On the destination cell, onEnteringCell is called on the ghost entity. This ghost is then converted to a real entity and onEnteredCell is called.

This method should be decorated with @bwdecorators.callableOnGhost since it will only be called on ghost entities.

Note: Think twice before using this callback. These can often be avoided by using smarter data types.

See:
Entity.onEnteringCell
Entity.onEnteredCell
Entity.onLeavingCell

def onLoseControlledBy( self, id ):

Parameters:
id The id of the controlledBy entity.

def onLoseWitness( self ):

def onMove( self, controllerID, userData ):

It is called when the entity has reached its destination or for Entity.navigateStep when the entity reaches the next waypoint.

Parameters:
controllerID | The id of the controller that triggered this callback.
userData | The user data that was passed to the navigation method

def onMoveFailure( self, controllerID, userData ):

It is called if the entity fails to reach its destination entity due to it no longer being avaliable, and is also called when the entity has not moved enough during a single tick from Entity.navigateStep.

See:
Entity.accelerateToEntity
Entity.moveToEntity
Entity.navigateStep

Parameters:
controllerID | The id of the controller that triggered this callback.
userData | The user data that was passed to the navigation method

def onNavigate( self, controllerID, userData ):

Parameters:
controllerID | The id of the controller that triggered this callback.
userData | The user data that was passed to Entity.navigate.

def onNavigateFailed( self, controllerID, userData ):

Parameters:
controllerID | The id of the controller that triggered this callback.
userData | The user data that was passed to Entity.navigate.

def onNoise( self, entity, propRange, distance, event, info ):

Parameters:
entity | The entity that made the noise.
propRange | The propagation range of the noise.
distance | This is how far away the noise was made.
event | The integer event number that was passed to Entity.makeNoise.
info | The integer info argument that was passed to Entity.makeNoise.

def onPassengerAlightAttempt( self ):

def onPassengerBoardAttempt( self ):

This method is not a good place to synchronise boarding of a single-seated vehicle, since it may be called simultaneously from two different cells. If you need to enforce such a rule, you should have a separate reservation step which sets a ghosted property to the (id of the) entity that has permission to ride it. This method can then check that the entity attempting to board does indeed hold the reservation.

def onRestore( self ):

def onSpaceGone( self ):

def onStartSeeing( self, entity, userData ):

See:
Entity.addVision

Parameters:
entity | The entity that has just entered this entity's vision.
userData |

def onStopSeeing( self, entity, userData ):

See:
Entity.addVision
Entity.onStopSeeingID

Parameters:
entity | The entity that has just left this entity's vision.
userData |

def onStopSeeingID( self, entityID, userData ):

See:
Entity.addVision
Entity.onStopSeeing

Parameters:
entityID | The id of the entity that has just left this entity's vision.
userData |

def onTeleport( self ):

See:
Entity.teleport

def onTeleportFailure( self ):

See:
Entity.teleport

def onTeleportSuccess( self, nearbyEntity ):

When the teleport has been caused by a call from the base entity, the position of the entity will be BigWorld.INVALID_POSITION. The desired position should be set in this callback. This will typically be the position of the nearby entity or a close offset.

The nearby entity argument is guaranteed to be a real entity. Two-way methods that modify state can be called on this argument. This can be useful if the nearby entity contains state for where the entity should be positioned.

See:
Entity.teleport

Parameters:
nearbyEntity The entity associated with the mailbox passed to Entity.teleport or Base.. This is guaranteed to be a real entity.

def onTimer( self, timerHandle, userData ):

Parameters:
timerHandle | The id of the timer.
userData | The user data passed in to Entity.addTimer.

def onTurn( self, controllerID, userData ):

Parameters:
controllerID | The id of the controller.
userData | The user data passed in to the Entity.addYawRotator call.

def onWindowOverflow( self ):

def onWitnessed( self, isWitnessed ):

When entities are created, their initial witness state is unwitnessed. If they are created within the AoI of a witness, then they will have Entity.onWitnessed( True ) called as soon as the witness is notified of this entity.

This can be useful as an optimisation. For example, CPU intensive entities may be able to pause their AI while they are not being watched.

See:
Entity.isWitnessed

Parameters:
isWitnessed A boolean indicating whether or not the entity is now witnessed.

def onWriteToDB( self ):

Attribute Documentation

allClients

See:
Entity.ownClient
Entity.clientEntity
Entity.otherClients

Type:
Read-only PyClient

aoiUpdateScheme

The available schemes are specified in bw.xml's cellApp/aoiUpdateSchemes section.

artificialLoad

This attribute allows this entity to report an additional amount of artificial load. It is useful as a hint to the load balancing if it is expected that this entity's load may increase by this amount in the future.

The value is added directly to the load of the local CellApp process. This means that the units are the fraction of the entire CellApp load that should be artificially accounted. This does assume that the CellApp machines are fairly compatible.

The value should generally be small, say 0.1 or less.

This feature should be used with care. Setting this value too large, for example, could adversely affect the load balancing.

base

Type:
Read-only BaseEntityMailBox

canBeSeen

If set to True, this attribute indicates that this Entity should be included in vision updates.

If set to False, the Entity will be 'invisible' to any Entity's vision controller.

See:
Entity.addVision

Type:
bool

className

The class name of this Entity.

Type:
Read-only string

client

This attribute is an alias for Entity.ownClient. It provides a PyClient object. This can be used to call functions on the client Entity. Function calls that are made via this PyClient object are only passed to the client that owns the entity.

See:
Entity.clientEntity
Entity.allClients
Entity.otherClients

Type:
Read-only PyClient

controlledBy

If a script makes changes to the pose of an entity, e.g. sets its direction directly, or teleports it to another space, then those changes are sent down to the client as a forced pose change. Future pose updates from the client are ignored until the forced change is acknowledged. This same mechanism is used if the physics checking system rules a client-initiated movement illegal.

Scripts may set this on any (real) entity to grant a client control of that entity - or revoke it. It is even possible to revoke or redirect the client's control of its own entity, in which case its position (if volatile) will be sent to the client in every update. (Any volatile positions of vehicles the client is on will also be sent every update.)

Type:
BaseEntityMailBox

debug_numTimesRealOffloaded

This is a 16 bit unsigned value and is expected to wrap at 65535.

direction

Changes to this data will not be propagated to clients if the volatileInfo for this Entity specifies that position is not to be updated.

This property is roll, pitch and yaw combined (in that order). All values are in radians.

Like Entity.position, this value is mutable.

If you want a copy of the current value, you should cast to a Vector3.

For example,
self.startDirection = Math.Vector3( self.direction )

Type:
Tuple of 3 floats as (roll, pitch, yaw)

fieldOfView

This attribute stores the angle of the vision cone in radians. Entities that are greater than this angle, in radians, from this entity's direction will not be seen. The field of view is double this number. For example, a field of view of 180 degrees (pi radians) would be equivalent to a vision cone angle of 90 degrees (pi/2 radians).

This attribute is deprecated due to the confusion it can cause. It is identical to the visionAngle attribute.

See:
Entity.addVision

Type:
float

hasWitness

Type:
boolean

id

Type:
Read-only Integer

isDestroyed

Type:
Read-only bool

isIndoors

isOnGround

Type:
Read-write bool

isOutdoors

isWitnessed

An entity is considered as being witnessed if it in a client-controlled entity's Area of Interest (AoI). This attribute is False when the entity is first created and will be set to True immediately upon entering the AoI of a client-controlled entity. However, BigWorld uses a lazy algorithm to change this attribute from True to False. Currently, it can take between 8 to 12 minutes after leaving the AoI of the last client-controlled entity before this attribute is set to False.

localPitch

Type:
Read-only Float.

localPosition

Type:
Tuple of 3 floats as (x, y, z).

localRoll

Type:
Read-only Float.

localYaw

Type:
Read-only Float.

otherClients

See:
Entity.ownClient
Entity.allClients
Entity.clientEntity

Type:
Read-only PyClient

ownClient

See:
Entity.clientEntity
Entity.allClients
Entity.otherClients

Type:
Read-only PyClient

pitch

Type:
Read-only Float

position

It is also important to consider the volatileInfo of the entity. If the position is not volatile, each change to this value will be sent down to all client applications within range.

Note: This property is mutable which means that you can change individual elements of the position. It also means if you keep a reference to it and the entity moves, this property will change.
self.position.y = 50.0

If you want a copy of the current value, you should cast to a Vector3.

For example,
self.startPosition = Math.Vector3( self.position )

Type:
Vector3

roll

Type:
Read-only Float

seeingHeight

This attribute stores the height on the Entity to use as the source of the current field of view, eg, eye-level of current Model. This should be changed as the point of vision changes, eg, if the Model crouches, but not when jumping because the height from the base of the Model is the same.

See:
Entity.addVision

Type:
float

shouldAutoBackup

This can be set to True, False or BigWorld.NEXT_ONLY.

shouldDropVision

If set to True, this attribute indicates that this Entity's seeingHeight and visibleHeight should be dropped by 2 metres or to the terrain surface, if within that 2m range. This is because on the Cell, the Entity moves on the BigWorld navPoly system. No part of any navPoly will be beneath the terrain or more than 2 metres higher, so by dropping these seeingHeight and visibleHeight by 2m, we ensure that the heights are relative to the terrain.

If set to False, the heights will remain relative to the navPoly, rather than the terrain.

See:
Entity.addVision

Type:
bool

spaceID

Type:
Read-only Integer.

stealthFactor

Type:
float

topSpeed

If set to 0 (the default) no physics checking is done. If set to greater than zero, entity movements are checked against chunk portals, and speed is checked against the value of this property.

Setting this value to a negative value is undefined.

Additionally, if this attribute value is greater than zero and if the value of the attribute topSpeedY is also greater than zero, then this attribute's value enforces the magnitude of the velocity along the x- and z-axes only, and value of the attribute topSpeedY restricts the magnitude of the velocity along the y-axis.

See:
Entity.topSpeedY

Type:
float

topSpeedY

If value of topSpeed attribute is not greater than zero, then the value of the topSpeedY attribute has no effect.

This attribute is only available on the real entity and reading/writing to this value on a ghost is not defined.

If set to zero, then the value of the attribute topSpeed applies to the magnitude of the velocity along x-, y- and z-axes.

See:
Entity.topSpeed

Type:
float

vehicle

Type:
Entity

velocity

Type:
Read-only tuple of 3 floats, as (x, y, z)

visibleHeight

This attribute stores the height that the vision controllers will use to determine whether this Entity can be seen. It should correspond to the height of the current Model and be updated if the Model changes height, eg, when crouched, but not when jumping because the height from the base of the Model is the same.

See:
Entity.addVision

Type:
float

visionAngle

This attribute stores the angle of the vision cone in radians. Entities that are greater than this angle, in radians, from this entity's direction will not be seen. The field of view is double this number. For example, a field of view of 180 degrees (pi radians) would be equivalent to a vision cone angle of 90 degrees (pi/2 radians).

See:
Entity.addVision

Type:
float

visionRange

This attribute stores the range, in metres, of the entity's vision. Entities further away than this distance will not be seen by this entity.

See:
Entity.addVision

Type:
float

volatileInfo

Sample .def Excerpt:
<Volatile>
    <position/>           <!-- always -->
    <yaw/>                <!-- always -->
    <pitch>20</pitch>     <!-- 20     -->
</Volatile>               <!-- roll never  -->

Type:
A sequence of 4 floats (or None objects)

yaw

Type:
Read-only Float


Matrix - BigWorld cell Documentation

Matrix Class Reference

[Math Module]

Matrix is part of the Math module. More...

import Math

Member Functions

def applyPoint( self, point ):
def applyToAxis( self, axis ):
def applyToOrigin( self ):
def applyV4Point( self, point ):
def applyVector( self, vec ):
def get( self, row, col ):
def invert( self ):
def lookAt( self, pos, direction, up ):
def orthogonalProjection( self, width, height, near, far ):
def perspectiveProjection( self, fov, aspect, near, far ):
def postMultiply( self, pre ):
def preMultiply( self, pre ):
def set( self, m ):
def setElement( self, row, col, val ):
def setIdentity( self ):
def setRotateX( self, rot ):
def setRotateY( self, rot ):
def setRotateYPR( self, ypr ):
def setRotateZ( self, rot ):
def setScale( self, scales ):
def setTranslate( self, translations ):
def setZero( self ):

Attributes

determinant | Read-Only Float
isMirrored | Read-Only Integer (as boolean)
pitch | Read-Only Float
roll | Read-Only Float
translation | Vector3
yaw | Read-Only Float

Detailed Description

The Matrix class is a 4x4 matrix. It inherits from MatrixProvider.

A Matrix can be created using the Math.Matrix() function.

Member Function Documentation

def applyPoint( self, point ):

This function applies the matrix to the specified point. The point should be a Vector3, but will be treated as if it were a Vector4 with the fourth component being 1.0.

For example:
>>>	m = Math.Matrix()
>>>	m.setTranlate( (2,4,8) )
>>> v = Math.Vector3( 1,2,3 )
>>> m.applyPoint( v )
(3.000, 6.000, 11.000)
The example applies a translation matrix to the point (1,2,3)

Parameters:
point A Vector3 which is the point to be transformed.

Returns:
A Vector3 which is the transformed point.

def applyToAxis( self, axis ):

This function applies the matrix to the specified axis. The axis is specified using an integer between 0 and 2, with 0 corresponding to the x-axis, 1 to the y-axis and 2 to the z-axis. Numbers above 2 have undefined results.

For example:
>>>	m = Math.Matrix()
>>> m.setRotateY( 3.1415 / 2 )
>>>	m.applyToAxis( 2 )
(1.00, 0.00, 0.00)
This example rotates the z-axis through 90 degrees around the y-axis leaving it lined up with the old x-axis.

Parameters:
axis an Ingeger between 0 and 2, specifying the axis to transform

Returns:
a Vector3, which is the transformed axis.

def applyToOrigin( self ):

This function applies the matrix to the origin. This is exactly the same as calling the applyPoint function on the point (0,0,0), or the applyV4Point function on (0,0,0,1). It is also the same as the translation attribute.

For example:
>>>	m = Math.Matrix()
>>> m.setTranlation( (1,2,3) )
>>>	m.applyToOrigin()
(1.00, 2.00, 3.00)
This example applies a translation matrix to the origin.

Returns:
a Vector3 which is the transformed origin.

def applyV4Point( self, point ):

This function applies the matrix to the specified point. In this case a point is Vector4, with the 4th component being w.

For example:
>>>	m = Math.Matrix()
>>>	m.setTranlate( (2,4,8) )
>>> v = Math.Vector4( 1,2,3,1 )
>>> m.applyPoint( v )
(3.000, 6.000, 11.000, 1.000)
The example applies a translation matrix to the point (1,2,3,1)

Parameters:
point A Vector4 which is the point to be transformed.

Returns:
A Vector4 which is the transformed point.

def applyVector( self, vec ):

This function applies the matrix to the specified vector. The vector is a Vector3, and the last row of the matrix is ignored in the calculations.

For example:
>>>	m = Math.Matrix()
>>>	m.setTranlate( (2,4,8) )
>>> v = Math.Vector3( 1,2,3 )
>>> m.applyVector( v )
(1.000, 2.000, 3.000)
The example applies a translation matrix to the Vector3 (1,2,3)

Parameters:
vec A Vector3 which is the Vector3 to be transformed.

Returns:
A Vector3 which is the transformed Vector3.

def get( self, row, col ):

This method gets the value of a specified element of the matrix.

For example:
>>> m = Math.Matrix()
>>>	m.setTranslate( (1.0, 2.0, 3.0) )
>>> m.get( 3, 0 )
1.0
>>>	m.get( 3, 1 )
2.0
>>>	m.get( 3, 2 )
3.0
The example sets a translation matrix, and then obtains the components one by one.

Parameters:
row | An integer between 0 and 3. This is the row that is being returned.
col | An integer between 0 and 3. This is the column that is being returned.

Returns:
A float. This is the value of the specified element.

def invert( self ):

This method inverts the matrix. Inverting a matrix is only defined if the determinant is non-zero. If this method is called on a matrix with zero determinant, then the matrix is set to the identity matrix.

In terms of transformations, inverting a matrix "undoes" its transform.

For example:
>>> m = Math.Matrix()
>>> m.setTranslate( (1.0, 2.0, 3.0 ) )
>>> m.invert()
>>> m.tranlation
(-1.000, -2.000, -3.000)
>>> m1 = Math.Matrix()
>>> m1.setRotateY( 1.0 )
>>> m1.invert()
>>> m1.yaw
-1.0000
The example shows how inverting the matrix "undoes" the translation for m, and the rotation for m1. The same holds for composite transformations.

def lookAt( self, pos, direction, up ):

This method sets the matrix up to transform by a specified position, looking in a given direction with the z-axis and with the specified vertical.

For example:
modelMat = Math.Matrix()
modelMat.setTranslate( (0,0,0) )
cameraMat = Math.Matrix()
pos = Math.Vector3( 0, 0, -10 )
cameraMat.lookAt( pos, modelMat.applyToOrigin() - pos, (0,1,0) )
This example sets up the camera matrix to be positioned at (0,0,-10) and to be looking at the model which is placed at the origin. The cameras up direction will be the same as the worlds.

Parameters:
pos | The position to set the matrix translation to.
direction | The direction to orient the "look at" matrix.
up | The vertical axis for the camera.

def orthogonalProjection( self, width, height, near, far ):

This function sets the matrix to a left-handed orthogonal projection matrix. It can be used for a projection matrix on a camera to give a non-perspective (orthogonal) view on the world.

Parameters:
width | a Float, the width of the viewport.
height | a Float, the height of the viewport.
near | a Float, the distance to the near clipping plane.
far | a Float, the distance to the far clipping plane.

def perspectiveProjection( self, fov, aspect, near, far ):

This function sets the matrix to a left-handed perspective projection matrix. This can be used as the projection matrix on a camera to give a perspective view on the world.

Parameters:
fov | A Float, the field of view.
aspect | A Float, the aspect ratio (ratio of the width to the height).
near | A Float, the distance to the near clipping plane.
far | A Float, the distance to the far clipping plane.

def postMultiply( self, pre ):

This method post multiplies this matrix by the specified matrix. Post-multiplication means that the specified matrix is on the right of the multiplication operator. In transformation terms, the specified matrix is applied AFTER this matrix.

For example:
>>> tr = Math.Matrix()
>>> tr.setTranslate( (1,0,0) )
>>> ro = Math.Matrix()
>>> ro.setRotateY( 3.14159 / 2 )
>>> out = Math.Matrix()
>>> out.set(ro)
>>> out.postMultiply(tr)
>>> out.translation
(1.000, 0.000, 0.000)
>>> out.yaw
-1.5707
This example shows that post-multiplying the rotation by the translation applies the translation second, after rotation. This results in the initial frame being rotated, and then translated, resulting in an unaltered translation. Compare this to the result from pre-multiplication.

Parameters:
pre A Matrix which is the matrix to post-multiply by.

def preMultiply( self, pre ):

This method pre multiplies this matrix by the specified matrix. Pre-multiplication means that the specified matrix is on the left of the multiplication operator. In transformation terms, the specified matrix is applied BEFORE this matrix.

For example:
>>> tr = Math.Matrix()
>>> tr.setTranslate( (1,0,0) )
>>>	ro = Math.Matrix()
>>> ro.setRotateY( 3.14159 / 2 )
>>> out = Math.Matrix()
>>>	out.set(ro)
>>> out.preMultiply(tr)
>>>	out.translation
(0.000, 1.000, 0.000)
>>>	out.yaw
-1.5707
This example shows that pre-multiplying the rotation by the translation applies the translation first, and then the rotation. This results in the transformed position being rotated, resulting in it being in a different position. Compare this to the results in the example on post-multiplication.

Parameters:
pre a Matrix which is the matrix to pre-multiply by.

def set( self, m ):

This method sets the matrix to be the same as the supplied matrix. It has the same effect as assignment.

For example:
m1.set( m2 ) # sets matrix m1 equal to matrix m2.

Parameters:
m the matrix to set this matrix equal to.

def setElement( self, row, col, val ):

This method sets the specified element of the matrix to the specified value. The element is specified by the first two arguments, which are the row and the column respectively.

For example:
>>> m = Math.Matrix()
>>> m.setElement( 3, 0, 1.0 )
>>> m.setElement( 3, 1, 2.0 )
>>> m.setElement( 3, 2, 4.0 )
>>> m.translation
(1.0, 2.0, 4.0)
The example sets the translation components of the matrix, element by element.

Parameters:
row | An integer between 0 and 3. This is the row that is being set.
col | An integer between 0 and 3. This is the column that is being set.
val | A float. The value to set the element to.

def setIdentity( self ):

This method sets the matrix to the identity matrix (with 1s down the main diagonal, and zeros elsewhere).

The important property of the identity matrix is that if it is multiplied by another matrix, the product is that other matrix.

For example:
>>> matI.setIdentity() # sets the matrix mat to be the identity matrix.
>>> matNew = matOther.preMultiply( matI )
>>>	matNew == matOther
1
The example shows setting a matrix to the identity matrix and then multiplying it by another matrix, which results in the same matrix as before.

def setRotateX( self, rot ):

This method sets the matrix to rotate around the x-axis by the specified amount. Zero rotation is specified along the z-axis, with positive rotation being clockwise.

The translation and rotations around the y and z axes are cleared.

For example:
# sets the matrix to rotate by 1.0 radians clockwise about the x-axis.
mat.setRotateX( 1.0 )

Parameters:
rot The size of the rotation.

def setRotateY( self, rot ):

This method sets the matrix to rotate around the y-axis by the specified amount. Zero rotation is specified along the z-axis, with positive rotation being anti-clockwise.

The translation and rotations around the x and z axes are cleared.

For example:
# sets the matrix to rotate by 1.0 radians anti-clockwise about the y-axis.
mat.setRotateY( 1.0 )

Parameters:
rot The size of the rotation.

def setRotateYPR( self, ypr ):

This method sets the rotation about all three axes with one function call. It takes a Vector3, the components of which specify the yaw (rotation about y, with 0 along the z-axis, increasing anti-clockwise), pitch ( rotation about x, with 0 along the z-axis, increasing clockwise), and roll (rotation about z, with 0 along the x-axis, increasing clockwise).

The translation is cleared.

For example:
mat.setRotateYPR( (1.0, 2.0, 3.0) )
sets the matrix to have yaw 1.0, pitch of 2.0 and roll of 3.0, applied in that order.

Parameters:
ypr a Vector3 specifying the yaw, pitch and roll.

def setRotateZ( self, rot ):

This method sets the matrix to rotate around the z-axis by the specified amount. Zero rotation is specified along the x-axis, with positive rotation being clockwise.

The translation and rotations around the x and y axes are cleared.

For example:
# sets the matrix to rotate by 1.0 radians clockwise about the z-axis.
mat.setRotateZ( 1.0 )

Parameters:
rot The size of the rotation.

def setScale( self, scales ):

This method sets the matrix to be a scale matrix, with the specified Vector3 scaling along the x, y and z axes.

For example:
# set the matrix mat to scale 2 times along the x-axis, 3 times along
# the y-axis and 4 times along the z-axis.
mat.setScale( (2, 3, 4) )

Parameters:
scales A Vector3, with the each component being the scale along the corresponding axis.

def setTranslate( self, translations ):

This method sets the matrix to be a translation matrix, with the specified Vector3 being the translations along the x, y and z axes.

For example:
# set the matrix to translate by 4 along the x-axis, 5 along the y-axis
# and 6 along the z-axis.
mat.setTranslate( (4, 5, 6) )

Parameters:
translations A Vector3, with each component being the translation along the corresponding axis.

def setZero( self ):

This method sets the matrix to the zero matrix (with all elements equal to zero).

For example:
# sets the matrix mat to be the zero matrix.
mat.setZero()

Attribute Documentation

determinant

This attribute returns the determinant of the matrix.

The determinant of a matrix has many mathematical uses. In the context of a 3d engine the most likely use is to compare it to zero. If the determinant of a matrix is zero, then the matrix cannot be inverted.

Type:
Read-Only Float

isMirrored

This attribute is non-zero(true) if the matrix is mirrored, and zero (false) if the matrix is non mirrored. This is derived from the elements of the matrix.

If a matrix, when applied to a coordinate system, changes it from a left hand system to a right hand system, then the matrix is described as mirrored.

Type:
Read-Only Integer (as boolean)

pitch

This attribute is the rotation specified by the matrix around the x-axis. Zero pitch is along the z-axis with increase in pitch rotating clockwise when looking along the x-axis.

Type:
Read-Only Float

roll

This attribute is the rotation specified by the matrix around the z-axis. Zero pitch is along the x-axis with increase in roll rotating clockwise when looking along the z-axis.

Type:
Read-Only Float

translation

This attribute is the translation component of the matrix. Unlike the pitch, yaw and roll attributes, it is both read and write.

Type:
Vector3

yaw

This attribute is the rotation specified by the matrix around the y-axis. Zero yaw is along the z-axis, with increase in yaw rotating anti-clockwise when looking along the y-axis.

Type:
Read-Only Float


MatrixInverse - BigWorld cell Documentation

MatrixInverse Class Reference

[Math Module]

MatrixInverse is part of the Math module. More...

import Math

Parent Classes

MatrixProvider → PyObjectPlus

Attributes

source Read-Write MatrixProvider

Detailed Description

A subclass of MatrixProvider. This provides the result of the expression 'invert(source)', where source is it's MatrixProvider argument. An instance of this class can be created via the factory method Math. MatrixInverse.

It is not possible to directly access many of the internal attributes of a MatrixInverse. To view this data it is necessary to construct a Matrix which is a copy of this, & read the values from it. For example:
# import Math module
import Math

# create a MatrixInverse which provides the inverse of matrix1
minv = Math.MatrixInverse(matrix1)

# create a MatrixProvider from the MatrixInverse
m = Math.Matrix( minv )

# print the yaw
print m.yaw
Note that a Matrix constructed as a copy of a MatrixInverse will only resemble the MatrixInverse at the time that it is created. It will not update to reflect changes.

Where the source attibute is not assigned, the result will be equal to the identity matrix.

Attribute Documentation

source

Type:
Read-Write MatrixProvider


MatrixProduct - BigWorld cell Documentation

MatrixProduct Class Reference

[Math Module]

MatrixProduct is part of the Math module. More...

import Math

Parent Classes

MatrixProvider → PyObjectPlus

Attributes

a | Read-Write MatrixProvider
b | Read-Write MatrixProvider

Detailed Description

A subclass of MatrixProvider. This provides the result of the expression 'a x b', where a and b are it's MatrixProvider arguments. An instance of this class can be created via the factory method Math. MatrixProduct.

It is not possible to directly access many of the internal attributes of a MatrixProduct. To view this data it is necessary to construct a Matrix which is a copy of this, & read the values from it. For example:
# import Math module
import Math

# create a MatrixProduct which provides the product of matrix1 and matrix2
mprod = Math.MatrixProduct()
mprod.a = matrix1
mprod.b = matrix2

# create a MatrixProvider from the MatrixProduct
m = Math.Matrix( mprod )

# print the yaw
print m.yaw
Note that a Matrix constructed as a copy of a MatrixProduct will only resemble the MatrixProduct at the time that it is created. It will not update to reflect changes.

Where a and/or b are not assigned, they are treated as if they were the equal to the identity matrix.

Attribute Documentation

a

Type:
Read-Write MatrixProvider

b

Type:
Read-Write MatrixProvider


MatrixProvider - BigWorld cell Documentation

MatrixProvider Class Reference

[Math Module]

MatrixProvider is part of the Math module. More...

import Math

Parent Classes

PyObjectPlus

Detailed Description

A matrix provider is the base class for all matrices used as transforms. In many cases when the attribute of a particular object has a MatrixProvider assigned to it, it stores a reference to the original MatrixProvider, rather than creating a copy.

For example, in the CursorCamera, its target could be an Entity's world transformation matrix. As the entity moves around and updates its matrix, the Camera, which stores a reference to this matrix, automatically follows along.

In addition, sometimes the original MatrixProvider doesn't actually store the matrix but calculates it on the fly. For example, the DiffDirProvider provides the matrix to move from a source position to a destination position.

The base class has no attributes or methods.

The easiest way to examine the actual elements of the matrix is to create a Matrix based on the MatrixProvider. This can be done with the following code:
matrix = Math.Matrix( matrixProvider )
matrix can then be interrogated using all the Matrix methods and functions. Updating matrix will not update matrixProvider, however.


Plane - BigWorld cell Documentation

Plane Class Reference

[Math Module]

Plane is part of the Math module. More...

import Math

Member Functions

def init( self, p0, p1, p2 ):
def intersectRay( self, src, dst ):

Detailed Description

The Plane class is a 3d plane

A Plane can be created using the Math. Plane() function.

Member Function Documentation

def init( self, p0, p1, p2 ):

This method initialises the plane equation so that the input points lie on it. The points should be in a clockwise order when looked at from the front of the plane. The points must not be colinear.

Parameters:
p0 | A Vector3 point on the plane.
p1 | A Vector3 point on the plane.
p2 | A Vector3 point on the plane.

Returns:
The location of the intersection

def intersectRay( self, src, dst ):

This method calculates the intersection of a ray with This plane

Parameters:
src | A point of the source ray
dst | The direction of the ray

Returns:
The location of the intersection


PyClient - BigWorld cell Documentation

PyClient Class Reference

PyClient is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

PyObjectPlus

Detailed Description

A PyClient is the device through which a real cell Entity is able to call methods on its client instances. A new PyClient object is created by BigWorld each time an entity's "client", "otherClients" or "allClients" attributes are accessed, and each time an entity's "clientEntity" function is called. Objects of this type cannot otherwise be created via script.

A PyClient can be used to send method calls to either the client which owns the entity, all clients except the one which owns the entity, or all clients. It can also be used to call methods on a different entity which is owned by the same client. These options are set when the PyClient is created, and cannot be altered afterwards via python. The PyClient objects provided by the entity members client, otherClients, allClients and clientEntity are each set up differently in these respects, as described in the Entity class documentation.

PyClient objects have no default attributes or methods, however BigWorld populates them with ClientCaller objects which represent the methods that can be called. These are built using information provided in the entity def files. A ClientCaller object can then be called as if it were the method that it represents, which causes it to add a request to call the appropriate function on the next bundles that are sent to the appropriate clients.

Example:

If the .def file "myEntityClass.def" contained the following
    <ClientMethods>
        <pointAt>
            <Arg> OBJECT_ID </Arg> <!-- entity to point at -->
        </pointAt>
    </ClientMethods>
then where "myEntity" is an instance of "myEntityClass", the following python code would be valid.
# This example tells myEntity to point at the entity with ID #100, on a
# range of clients.

# the client which owns myEntity
myEntity.client.pointAt( 100 )

# all clients other than the one which owns myEntity
myEntity.otherClient.pointAt( 100 )

# all clients
myEntity.allClients.pointAt( 100 )


PyEntities - BigWorld cell Documentation

PyEntities Class Reference

PyEntities is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

PyObjectPlus

Member Functions

def get( self, id, defaultValue ):
def has_key( self, key ):
def items( self ):
def keys( self ):
def values( self ):

Detailed Description

An instance of PyEntities emulates a dictionary of PyEntity objects, indexed by its id attribute. It does not support item assignment, but can be used with the subscript operator. Note that the key must be an integer, and that a key error will be thrown if the key does not exist in the dictionary. Instances of this class are used by the engine to make lists of entities available to python. They cannot be created via script, nor can they be modified.

Code Example:
e = BigWorld.entities # this is a PyEntities object
print "The entity with ID 100 is", e[ 100 ]
print "There are", len( e ), "entities"

Member Function Documentation

def get( self, id, defaultValue ):

Parameters:
id | The id of the entity to find.
defaultValue | An optional argument that is the return value if the entity cannot be found. This defaults to None.

Returns:
The entity with the input id or the default value if not found.

def has_key( self, key ):

Parameters:
key key is the integer key to be searched for.

Returns:
A boolean. True if the key was found, false if it was not.

def items( self ):

Returns:
A list containing all of the (ID, entity) pairs, represented as tuples containing an integer ID and an entity.

def keys( self ):

Returns:
A list containing all of the keys.

def values( self ):

Returns:
A list containing all of the entities.


PyObjectPlus - BigWorld cell Documentation

PyObjectPlus Class Reference

PyObjectPlus is an actualised class. It is not bound to any module and cannot be directly instantiated.

Detailed Description

This is the abstract base class for all Python classes which are implemented in the engine. Every other class inherits, directly or indirectly from PyObjectPlus.


PyOutputWriter - BigWorld cell Documentation

PyOutputWriter Class Reference

PyOutputWriter is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

PyObjectPlus

Member Functions

def write( self, string ):

Attributes

softspace Read-Write String

Detailed Description

This class is used by BigWorld to implement a Python object that redirects Python's stdout and stderr streams to Dev Studio's output window and a log file which defaults to Python.log. The BigWorld client actually uses an instance of a subclass of this called BWOutputWriter, which also sends stdout and stderr to the BigWorld Python colsole. This is automatically set up by the engine, and neither of these classes nor any instances of them can be accessed via script.

Member Function Documentation

def write( self, string ):

Write a string to this writer's outputs. The Python io system calls this.

Parameters:
string The string to write.

Returns:
None

Attribute Documentation

softspace

This is required for use by the Python io system so that instances of PyOutputWriter can be used as streams.

Type:
Read-Write String


PySTLSequence - BigWorld cell Documentation

PySTLSequence Class Reference

PySTLSequence is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

PyObjectPlus

Attributes

length Integer

Detailed Description

This class is used to expose STL sequences from the engine to Python. It behaves in exactly the same way as a standard Python sequence, except that it has a length property. In particular, if v, x, y and z are sequences, either standard Python or PySTLSequence and i and j are integers and n is a number, then the following operations are valid:

len(x)
x + y
x * n
x[i]
x[i:j]
x[i] = v
x[i:j] = v
v in x
x += y
x *= n

Attribute Documentation

length

This attribute returns the number of elements in the sequence

Type:
Integer


RemoteEntityMethod - BigWorld cell Documentation

RemoteEntityMethod Class Reference

RemoteEntityMethod is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

PyObjectPlus

Attributes

argumentTypes
returnValueTypes

Detailed Description

An instance of RemoteEntityMethod is return from an entity mailbox to allow the calling of a method on a remote machine

Attribute Documentation

argumentTypes

This attribute is a tuple that describes the type of each argument that an entity method expects. Each element in the tuple is a 2-tuple containing the argument's name and a string describing the type of that argument.

returnValueTypes

This attribute is a tuple that describes the type of each return value that an entity method expects. Each element in the tuple is a 2-tuple containing the return value's name and a string describing the type of that return value.


ServerEntityMailBox - BigWorld cell Documentation

ServerEntityMailBox Class Reference

ServerEntityMailBox is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

PyEntityMailBox → PyObjectPlus

Attributes

className | string
component | string
id | integer
ip | integer

Detailed Description

This class implements a mailbox that can send to a server Entity (ie, Cell or Base Entity). It is not instantiated directly, but used by CellEntityMailBox and BaseEntityMailBox.

Attribute Documentation

className

The class name of the associated Entity.

Type:
string

component

The server component of the associated Entity.

Type:
string

id

The id of the associated Entity.

Type:
integer

ip

The IP address value of the associated Entity. If zero, the mailbox is invalid.

Type:
integer


SharedData - BigWorld cell Documentation

SharedData Class Reference

SharedData is an actualised class. It is not bound to any module and cannot be directly instantiated.

Parent Classes

PyObjectPlus

Member Functions

def get( self ):
def has_key( self, key ):
def items( self ):
def keys( self ):
def values( self ):

Detailed Description

An instance of this class emulates a dictionary of data shared between server components.

Code Example:
sharedData = BigWorld.globalData
print "The main mission entity is", sharedData[ "MainMission" ]
print "There are", len( sharedData ), "global data entries."

Member Function Documentation

def get( self ):

Returns:
The found value.

def has_key( self, key ):

Parameters:
key The key to be searched for.

Returns:
A boolean. True if the key was found, false if it was not.

def items( self ):

Returns:
A list containing all of the (key, value) pairs.

def keys( self ):

Returns:
A list containing all of the keys.

def values( self ):

Returns:
A list containing all of the values.


UserDataObject - BigWorld cell Documentation

UserDataObject Class Reference

[BigWorld Module]

UserDataObject is part of the BigWorld module. More...

import BigWorld

Parent Classes

PyObjectPlus

Attributes

direction | Read only Tuple of 3 floats as (roll, pitch, yaw)
guid | Read-only GUID (string)
pitch | Read-only Float
position | Read only Tuple of 3 floats as (x, y, z)
roll | Read-only Float
yaw | Read-only Float

Detailed Description

A user data object. Defined by DEF files.

Attribute Documentation

direction

Type:
Read only Tuple of 3 floats as (roll, pitch, yaw)

guid

Type:
Read-only GUID (string)

pitch

Type:
Read-only Float

position

Type:
Read only Tuple of 3 floats as (x, y, z)

roll

Type:
Read-only Float

yaw

Type:
Read-only Float


Vector2 - BigWorld cell Documentation

Vector2 Class Reference

[Math Module]

Vector2 is part of the Math module. More...

import Math

Member Functions

def cross2D( self, v2 ):
def distSqrTo( self, v2 ):
def distTo( self, v2 ):
def dot( self, rhs ):
def list( self ):
def normalise( self ):
def scale( self, s ):
def set( self ):
def tuple( self ):

Attributes

length | Read-only float
lengthSquared | Read-only float

Detailed Description

The Vector2 class is a 2-element vector. It can be created using Math. Vector2() function.

The elements of Vector2 are referred as members x and y.

Vector2 supports following operations: Addtion: ex. v1 = v2 + v3 Subtraction: ex. v1 = v2 - v3 Negative: ex. v1 = -v2 Positive: ex. v1 = +v2 True-value test: ex. if v1: statements. In this case v1 is true if v1.lengthSquared > 0.f In-place addition: ex. v1 += v2 In-place subtraction: ex. v1 -= v2 Length: ex. len(v1). In this case always returns 2. Index: ex. v1[0] equals to v1.x, v1[1] equals to v1.y. Slice: ex. v1[0:1] returns a tuple contains v1.x, v1[0:2] returns a Vector2 eqauls to v1 itself. Indexed Assignment: ex. v1[0] = 3.2 equals to v1.x = 3.2

Member Function Documentation

def cross2D( self, v2 ):

This function returns the magnitude of the cross product between two Vector2s.

The formula is v1.x * v2.y - v1.y * v2.x

Parameters:
v2 The vector on the right hand side of the cross product.

Returns:
The magnitude of the cross product (a float).

def distSqrTo( self, v2 ):

This function returns the square of the distance between two vectors. This is often used for comparisons between two distances, because it saves the computational expense of calculating a square root.

Parameters:
v2 the vector to calculated the distance to, from this vector.

Returns:
the square of the distance between the two vectors, as a float.

def distTo( self, v2 ):

This function returns the distance between two vectors.

Parameters:
v2 the vector to calculated the distance to, from this vector.

Returns:
the distance between the two vectors, as a float.

def dot( self, rhs ):

This function performs a dot product between this vector and the specified vector, and returns the product as a float. It doesn't effect this vector.

Dot product is defined to be the sum of the products of the individual components, ie:

x*x + y*y

Parameters:
rhs The vector to dot this vector with.

Returns:
The float which is the dot product.

def list( self ):

This function returns the vector converted to a list of 2 elements.

Returns:
The list representation of the vector.

def normalise( self ):

This function normalises this vector (scales it so that its length is exactly 1).

Returns:
None

def scale( self, s ):

Returns the value of this vector, mutiplied by a scalar, leaving this vector unaffected.

Parameters:
s the scalar to multiply by.

Returns:
returns the Vector2 product of the scalar with the vector.

def set( self ):

This function sets the value of a Vector2 to the specified value. It can take several different styles of argument:

- It can take a Vector2, which sets this vector equal to the argument.

- It can take a tuple, with the same size as the vector, assigning the first element to x and the second to y.

- It can take a floating point number, which will be assigned to all components of the vector.

Returns:
None

def tuple( self ):

Returns the vector converted to a tuple of 2 elements.

Returns:
the tuple representing the vector.

Attribute Documentation

length

Type:
Read-only float

lengthSquared

Type:
Read-only float


Vector3 - BigWorld cell Documentation

Vector3 Class Reference

[Math Module]

Vector3 is part of the Math module. More...

import Math

Member Functions

def cross2D( self, v2 ):
def distSqrTo( self, v2 ):
def distTo( self, v2 ):
def dot( self, rhs ):
def flatDistSqrTo( self, v2 ):
def flatDistTo( self, v2 ):
def list( self ):
def normalise( self ):
def scale( self, s ):
def set( self ):
def tuple( self ):

Attributes

length | Read-only float
lengthSquared | Read-only float
pitch | Read-only float
yaw | Read-only float

Detailed Description

The Vector3 class is a 3-element vector. It can be created using Math.Vector3() function.

The elements of Vector3 are referred as members x, y and z.

Vector3 supports following operations: Addtion: ex. v1 = v2 + v3 Subtraction: ex. v1 = v2 - v3 Cross product: ex. v1 = v2 * v3 Negative: ex. v1 = -v2 Positive: ex. v1 = +v2 True-value test: ex. if v1: statements. In this case v1 is true if v1.lengthSquared > 0.f In-place Addition: ex. v1 += v2 In-place subtraction: ex. v1 -= v2 In-place cross product: ex. v1 *= v2 Length: ex. len(v1). In this case always returns 3. Index: ex. v1[0] equals to v1.x, v1[1] equals to v1.y, etc. Slice: ex. v1[0:1] returns a tuple contains v1.x, v1[0:2] returns a Vector2 consists of x and y. Indexed Assignment: ex. v1[0] = 3.2 equals to v1.x = 3.2

Member Function Documentation

def cross2D( self, v2 ):

This function returns the magnitude of the cross product between two Vector3.

The formula is v1.x * v2.z - v1.z * v2.x

Parameters:
v2 The vector on the right hand side of the cross product.

Returns:
The magnitude of the cross product (a float).

def distSqrTo( self, v2 ):

This function returns the square of the distance between two vectors. This is often used for comparisons between two distances, because it saves the computational expense of calculating a square root.

Parameters:
v2 the vector to calculated the distance to, from this vector.

Returns:
the square of the distance between the two vectors, as a float.

def distTo( self, v2 ):

This function returns the distance between two vectors.

Parameters:
v2 the vector to calculated the distance to, from this vector.

Returns:
the distance between the two vectors, as a float.

def dot( self, rhs ):

This function performs a dot product between this vector and the specified vector, and returns the product as a float. It doesn't effect this vector.

Dot product is defined to be the sum of the products of the individual components, ie:

x*x + y*y + z*z

Parameters:
rhs The vector to dot this vector with.

Returns:
The float which is the dot product.

def flatDistSqrTo( self, v2 ):

This function calculates the distance squared between the points in the XZ plane. This is often used for comparisons between two distances, because it saves the computational expense of calculating a square root.

Parameters:
v2 the vector to calculated the distance to, from this vector.

Returns:
the distance squared between the two vectors, as a float.

def flatDistTo( self, v2 ):

This function calculates the distance between the points in the XZ plane.

Parameters:
v2 the vector to calculated the distance to, from this vector.

Returns:
the distance between the two vectors, as a float.

def list( self ):

This function returns the vector converted to a list of 3 elements.

Returns:
The list representation of the vector.

def normalise( self ):

This function normalises this vector (scales it so that its length is exactly 1).

Returns:
None

def scale( self, s ):

Returns the value of this vector, mutiplied by a scalar, leaving this vector unaffected.

Parameters:
s the scalar to multiply by.

Returns:
returns the Vector3 product of the scalar with the vector.

def set( self ):

This function sets the value of a Vector3 to the specified value. It can take several different styles of argument:

- It can take a Vector3, which sets this vector equal to the argument.

- It can take a tuple, with the same size as the vector, assigning the first element to x, the second to y and the third to z.

- It can take a floating point number, which will be assigned to all components of the vector.

Returns:
None

def tuple( self ):

Returns the vector converted to a tuple of 3 elements.

Returns:
the tuple representing the vector.

Attribute Documentation

length

Type:
Read-only float

lengthSquared

Type:
Read-only float

pitch

Type:
Read-only float

yaw

Type:
Read-only float


Vector4 - BigWorld cell Documentation

Vector4 Class Reference

[Math Module]

Vector4 is part of the Math module. More...

import Math

Member Functions

def distSqrTo( self, v2 ):
def distTo( self, v2 ):
def dot( self, rhs ):
def list( self ):
def normalise( self ):
def scale( self, s ):
def set( self ):
def tuple( self ):

Attributes

length | Read-only float
lengthSquared | Read-only float

Detailed Description

The Vector4 class is a 4-element vector. It can be created using Math.Vector4() function.

The elements of Vector4 are referred as members x, y, z and w.

Vector4 supports following operations: Addtion: ex. v1 = v2 + v3 Subtraction: ex. v1 = v2 - v3 Negative: ex. v1 = -v2 Positive: ex. v1 = +v2 True-value test: ex. if v1: statements. In this case v1 is true if v1.lengthSquared > 0.f In-place Addition: ex. v1 += v2 In-place subtraction: ex. v1 -= v2 Length: ex. len(v1). In this case always returns 4. Index: ex. v1[0] equals to v1.x, v1[1] equals to v1.y, etc. Slice: ex. v1[0:1] returns a tuple contains v1.x, v1[0:3] returns a Vector3 consists of x, y and z. Indexed Assignment: ex. v1[3] = 3.2 equals to v1.w = 3.2

Member Function Documentation

def distSqrTo( self, v2 ):

This function returns the square of the distance between two vectors. This is often used for comparisons between two distances, because it saves the computational expense of calculating a square root.

Parameters:
v2 the vector to calculated the distance to, from this vector.

Returns:
the square of the distance between the two vectors, as a float.

def distTo( self, v2 ):

This function returns the distance between two vectors.

Parameters:
v2 the vector to calculated the distance to, from this vector.

Returns:
the distance between the two vectors, as a float.

def dot( self, rhs ):

This function performs a dot product between this vector and the specified vector, and returns the product as a float. It doesn't effect this vector.

Dot product is defined to be the sum of the products of the individual components, ie:

x*x + y*y + z*z + w*w

Parameters:
rhs The vector to dot this vector with.

Returns:
The float which is the dot product.

def list( self ):

This function returns the vector converted to a list of 4 elements.

Returns:
The list representation of the vector.

def normalise( self ):

This function normalises this vector (scales it so that its length is exactly 1).

Returns:
None

def scale( self, s ):

Returns the value of this vector, mutiplied by a scalar, leaving this vector unaffected.

Parameters:
s the scalar to multiply by.

Returns:
returns the Vector4 product of the scalar with the vector.

def set( self ):

This function sets the value of a Vector4 to the specified value. It can take several different styles of argument:

- It can take a Vector4, which sets this vector equal to the argument.

- It can take a tuple, with the same size as the vector, assigning the first element to x, the second to y, the third to z and the last to w.

- It can take a floating point number, which will be assigned to all components of the vector.

Returns:
None

def tuple( self ):

Returns the vector converted to a tuple of 4 elements.

Returns:
the tuple representing the vector.

Attribute Documentation

length

Type:
Read-only float

lengthSquared

Type:
Read-only float


Vector4Animation - BigWorld cell Documentation

Vector4Animation Class Reference

[Math Module]

Vector4Animation is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

duration | Read-Write float
keyframes | Read-Write list of tuples containing a float and a Vector4Provider
time | Read-Write float

Detailed Description

This is a subclass of Vector4Provider. This animates between the values provided by a number of Vector4Provider objects.

Keyframe values are specified as a list of tuples containing a time and a Vector4Provider. These are assumed to be in ascending order, so if a keyframe has a time which is before that of the previous keyframe, the Vector4 which is provided will insantly snap to the new value, rather than transitioning smoothly. Also, the Vector4Animation object will have a value equal to that of the first keyframe from the start of each cycle until the first keyframe has been hit. Similarly, a Vector4Animation object's value will be equal to that of the last keyframe, between the time of the last keyframe, and the end of the cycle.

Code Example:
# This example creates four PyChunkLight objects which demonstrate the
# use of Vector4Animation objects by using them to supply colour
# information to the lights.

# Import Math module
import Math

# Create the lights at positions ( 0, 10, 0 ), ( 20, 10, 0 ),
# ( 40, 10, 0 ), ( 60, 10, 0 ).
lights = []
for i in range( 4 ):
    newLight = BigWorld.PyChunkLight()
    newLight.position = ( i * 20, 10, 0 )
    newLight.outerRadius = 10
    newLight.visible = 1
    lights.append( newLight )

# Set up the first Vector4Animation, & apply it to the first light.
# This simply demonstrates how to set up a Vector4Animation which
# smoothly transitions across keyframes and loops without snapping.
# The light should start red, fade to green, fade to blue, then fade
# back to red again.
fadeV4 = Math.Vector4Animation()
fadeV4.duration = 1.5
fadeV4.keyframes = [ ( 0.0, ( 200, 0, 0, 0 ) ),    # red at 0.0s
                     ( 0.5, ( 0, 200, 0, 0 ) ),    # green at 0.5s
                     ( 1.0, ( 0, 0, 200, 0 ) ),    # blue at 1.0s
                     ( 1.5, ( 200, 0, 0, 0 ) ) ]   # red at 1.5s
lights[0].shader = fadeV4

# Set up the second Vector4Animation, & apply it to the second light.
# This shows how keyframes are treated when they're not listed in ascending
# order. The light should flash red, green, and blue, without transitioning
# smoothly.
flashV4 = Math.Vector4Animation()
flashV4.duration = 1.5
flashV4.keyframes = [ ( 0.5, ( 200, 0, 0, 0 ) ),    # red at 0.5s
                      ( 0.1, ( 0, 200, 0, 0 ) ),    # green at 0.1s
                      ( 1.0, ( 0, 200, 0, 0 ) ),    # green at 1.0s
                      ( 0.1, ( 0, 0, 200, 0 ) ) ]   # blue at 0.1s
lights[1].shader = flashV4

# Set up the third Vector4Animation, & apply it to the third light.
# This shows how the value provided by a Vector4Animation remains static
# between the start of a cycle and the first keyframe, and between the last
# keyframe and the end of a cycle. The light should hold red, smoothly
# transition to blue, hold blue, then snap instantly back to red at the
# beginning of the next cycle.
endSnapV4 = Math.Vector4Animation()
endSnapV4.duration = 1.5
endSnapV4.keyframes = [ ( 0.5, ( 200, 0, 0, 0 ) ),    # red at 0.5s
                        ( 1.0, ( 0, 0, 200, 0 ) ) ]   # blue at 1.0s
lights[2].shader = endSnapV4

# Set up the fourth Vector4Animation, & apply it to the fourth light.
# This shows how dynamic Vector4Provider objects can be used to provide the
# keyframes used by a Vector4Animation. The light should transition between
# off, flashing white, and solid white.
offV4 = ( 0, 0, 0, 0 )           # off keyframe
flashWhiteV4 = Math.Vector4LFO() # flashing white keyframe
flashWhiteV4.period = 0.2
flashWhiteV4.waveform = "SINE"
flashWhiteV4.phase = 0
flashWhiteV4.amplitude = 200
onV4 = ( 200, 200, 200, 200 )    # on keyframe
flashFadeV4 = Math.Vector4Animation()
flashFadeV4.duration = 6.0
flashFadeV4.keyframes = [ ( 0.0, offV4 ),        # off at 0.0s
                          ( 2.0, flashWhiteV4 ), # flashing white at 2.0s
                          ( 4.0, onV4 ),         # on 4.0s
                          ( 6.0, offV4 ) ]       # off 6.0s
lights[3].shader = flashFadeV4

Attribute Documentation

duration

Type:
Read-Write float

keyframes

Type:
Read-Write list of tuples containing a float and a Vector4Provider

time

Type:
Read-Write float


Vector4Basic - BigWorld cell Documentation

Vector4Basic Class Reference

[Math Module]

Vector4Basic is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

value Vector4

Detailed Description

This is a subclass of Vector4Provider. This is a static provider, and is therefore useful when a Vector4Provider which supplies a constant is required. No factory method exists to create an instance of this class, however one is automatically created whenever a tuple of 4 floats or a Vector4 is cast to a Vector4Provider. The following example shows this in action.

Code Example:
>>> # This shows how Vector4Basic objects are used by BigWorld to cast
>>> # tuples of four floats and Vector4 objects to Vector4Provider instances.
>>>
>>> # import Math module
>>> import Math
>>>
>>> # create a tuple of four floats
>>> tuple4 = ( 1.0, 2.0, 3.0, 4.5 )
>>>
>>> # create a Vector4
>>> vector4 = Math.Vector4( 2.0, 3.0, 4.0, 5.5 )
>>>
>>> # use both the Vector4 and the tuple of four floats as Vector4Provider
>>> # objects by setting them to the source attributes of a Vector4Product
>>> v4p = Math.Vector4Product()
>>> v4p.a = tuple4
>>> v4p.b = vector4
>>>
>>> # show that the Vector4 and the tuple of four floats have both been cast
>>> # to Vector4Basic objects
>>> print v4p.a, v4p.a.value
Vector4Basic at 0x0AB298B0 (1.000000, 2.000000, 3.000000, 4.500000)
>>> print v4p.b, v4p.b.value
Vector4Basic at 0x09EE75E8 (2.000000, 3.000000, 4.000000, 5.500000)

Attribute Documentation

value

Type:
Vector4


Vector4Combiner - BigWorld cell Documentation

Vector4Combiner Class Reference

[Math Module]

Vector4Combiner is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

a | Read-Write Vector4Provider
b | Read-Write Vector4Provider
fn | string

Detailed Description

Combines two Vector4Providers based on given function

A new Vector4Combiner is created using Math. Vector4Combiner method.

Attribute Documentation

a

Type:
Read-Write Vector4Provider

b

Type:
Read-Write Vector4Provider

fn

Type:
string


Vector4Distance - BigWorld cell Documentation

Vector4Distance Class Reference

[Math Module]

Vector4Distance is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

a | Read-Write Vector4
b | Read-Write Vector4

Detailed Description

This is a subclass of Vector4Provider. This provides a Vector4 value that returns the distance in metres between the two given Matrix providers. The distance is returned in all 4 components

Code Example:
# This creates a Vector4 that returns the distance from the camera
# to the player's head

# import the Math module
import Math

v = Math.Vector4Distance()
v.a = BigWorld.player().model.node("biped Head")
v.b = BigWorld.camera().invViewMatrix()

Attribute Documentation

a

Type:
Read-Write Vector4

b

Type:
Read-Write Vector4


Vector4LFO - BigWorld cell Documentation

Vector4LFO Class Reference

[Math Module]

Vector4LFO is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

amplitude | Read-Write float
period | Read-Write float
phase | Read-Write float
time | Read-Write float
waveform | Read-Write string

Detailed Description

This is a subclass of Vector4Provider. This provides Vector4 values using a Low Frequency Oscillator. Instances of this class can provide vectors which follow square, triangle, sine or sawtooth waveforms. Each component of the Vector4 provided by a Vector4LFO will be equal to the output of the Vector4LFO object's single oscillator. Consequently, all four components will have the same value. Note also that the waveform produced by a Vector4LFO will occupy the range between 0 and it's amplitude attribute. This means that the centre of a waveform produced by a Vector4LFO with an amplitude of 2 would be 1.

Code Example:
# This creates a flashing light whose brightness follows a sine wave.

# import the Math module
import Math

# create the light at ( 0, 0, 0 )
light = BigWorld.PyChunkLight()
light.position = ( 0, 0, 0 )
light.outerRadius = 10
light.visible = 1

# create the Vector4LFO, & use it to provide the light's colour
# The Vector4LFO provides a sine wave between the values 0 and 200,
# with a period of 2.0 seconds.
v = Math.Vector4LFO()
v.period = 2.0
v.waveform = "SINE"
v.phase = 0
v.amplitude = 200
light.shader = v

Attribute Documentation

amplitude

Type:
Read-Write float

period

Type:
Read-Write float

phase

Type:
Read-Write float

time

Type:
Read-Write float

waveform

Type:
Read-Write string


Vector4MatrixAdaptor - BigWorld cell Documentation

Vector4MatrixAdaptor Class Reference

[Math Module]

Vector4MatrixAdaptor is part of the Math module. More...

import Math

Parent Classes

MatrixProvider → PyObjectPlus

Attributes

position | Vector4Provider
source | Vector4Provider
style | Vector4Provider

Detailed Description

As a matrix adaptor, this class produces a MatrixProvider representation based upon a source Vector4Provider and it's rotational or scalable style.

A new Vector4MatrixAdaptor is created using Math. Vector4MatrixAdaptor method.

Attribute Documentation

position

Type:
Vector4Provider

source

Type:
Vector4Provider

style

Type:
Vector4Provider


Vector4Morph - BigWorld cell Documentation

Vector4Morph Class Reference

[Math Module]

Vector4Morph is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

duration | Read-Write float
target | Read-Write Vector4
time | Read-Write float

Detailed Description

This is a subclass of Vector4Provider. This provides a Vector4 value that morphs from the current value to the target value, over the specified duration. You can query its current value using the value attribute.

Code Example:
# This creates a Vector4 that smoothly changes from value to value.

# import the Math module
import Math

v = Math.Vector4Morph()
v.duration = 2.0

print Math.Vector4(v)
# '0, 0, 0, 0'

v.target = (4,4,4,4)
BigWorld.callback( 1.0, partial( checkValue, v ) )

def checkValue( v ):
    print Math.Vector4(v)
    # '2, 2, 2, 2'

    v.target = (2,3,1,9)
    v.time = v.duration
    print v.current
    # '2, 3, 1, 9'

Attribute Documentation

duration

Type:
Read-Write float

target

Type:
Read-Write Vector4

time

Type:
Read-Write float


Vector4Product - BigWorld cell Documentation

Vector4Product Class Reference

[Math Module]

Vector4Product is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

a | Read-Write Vector4Provider
b | Read-Write Vector4Provider

Detailed Description

This is a subclass of Vector4Provider. This provides the componentwise product of the outputs of two Vector4Provider objects, which means that each component of the output Vector4 is equal to the product of the equivalent components of the two source Vector4 objects. For example, the componentwise product of ( 1, 2, 0.5, 0 ) and ( 2, 2, 2, 2 ) is ( 2, 4, 1, 0 ).

If a Vector4Product instance has only one source Vector4Provider objects is specified, then the source's value is provided. If no source is specified then it provides ( 0, 0, 0, 0 ).

Code Example:
# This creates a flashing yellow light.
# It demonstrates the use of a Vector4Product by multiplying a Vector4LFO,
# which is used to provide the flash, with a Vector4Basic, which is used to
# provide the colour.

# import Math module
import Math

# create the light at ( 0, 10, 0 )
light = BigWorld.PyChunkLight()
light.outerRadius = 10
light.position = ( 0, 10, 0 )
light.visible = 1

# create the flashing Vector4LFO
flash = Math.Vector4LFO()
flash.period = 0.5
flash.waveform = "SAWTOOTH"
flash.phase = 0
flash.amplitude = 1

# create the yellow Vector4Basic
yellow = ( 200, 150, 0, 0 )

# create the Vector4Product and apply to the light
yellowFlash = Math.Vector4Product()
yellowFlash.a = flash
yellowFlash.b = yellow
light.shader = yellowFlash

Attribute Documentation

a

Type:
Read-Write Vector4Provider

b

Type:
Read-Write Vector4Provider


Vector4Provider - BigWorld cell Documentation

Vector4Provider Class Reference

[Math Module]

Vector4Provider is part of the Math module. More...

import Math

Parent Classes

PyObjectPlus

Attributes

value Read-Only Vector4

Detailed Description

Vector4Provider is the abstract base class for all objects which supply a dynamic Vector4. In many cases when the attribute of a particular object has a Vector4Provider assigned to it, it stores a reference to the original Vector4Provider rather than creating a copy.

Code Example:
# This example creates a flashing light at ( 0, 10, 0 ).
# The light flashes because the Vector4Provider assigned to its shader
# attribute provides a dynamic Vector4, and the light uses this to
# determine its colour.

# Import Math module
import Math

# Create a light at positions ( 0, 10, 0 )
newLight = BigWorld.PyChunkLight()
newLight.position = ( i * 20, 10, 0 )
newLight.outerRadius = 10
newLight.visible = 1

# Set up a Vector4Animation, & apply it to the light.
fadeV4 = Math.Vector4Animation()
fadeV4.duration = 1.5
fadeV4.keyframes = [ ( 0.0, ( 200, 0, 0, 0 ) ),    # red at 0.0s
                     ( 0.5, ( 0, 200, 0, 0 ) ),    # green at 0.5s
                     ( 1.0, ( 0, 0, 200, 0 ) ),    # blue at 1.0s
                     ( 1.5, ( 200, 0, 0, 0 ) ) ]   # red at 1.5s
newLight.shader = fadeV4

When a tuple of four floats or a Vector4 is used in place of a Vector4Provider it is cast to a Vector4Basic, which is a simple static subclass of Vector4Provider. See the documentation for Vector4Basic for an example.

Vector4Providers can be used to provide dynamic input to PyChunkLight objects, GUI shaders, TintShaderPSA objects, and the PyModel dye system.

This base class provides no methods, and only one attribute, which is the Vector4 currently being provided.

Attribute Documentation

value

Type:
Read-Only Vector4


Vector4Shader - BigWorld cell Documentation

Vector4Shader Class Reference

[Math Module]

Vector4Shader is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Member Functions

def addOp( self, opcode, outreg, param1, param2 ):

Detailed Description

The Vector4Shader implements a Vector4Provider that can be used to emulate a pixel shader implementation for 2D GUI components.

The following code example show how to create a flickering light, for example when a spot fire occurs for "duration" and fades out gracefully.

code:
import BigWorld
from Math import Vector4Shader
from Math import Vector4LFO
from Math import Vector4Animation
from V4ShaderConsts import _mul
from V4ShaderConsts import _r0
from V4ShaderConsts import _r1

#and in class FlickeringLight...

self.light = BigWorld.PyChunkLight()
self.light.innerRadius = self.innerRadius
self.light.outerRadius = self.outerRadius

self.lightFaderAnim = Vector4Animation()
self.lightFaderAnim.time = 0
self.lightFaderAnim.duration = duration
col = Vector4(self.colour)
self.lightFaderAnim.keyframes = [(0.0,(0,0,0,0)),(0.25,col),
    (duration*0.5,col),(duration,(0,0,0,0))]

lfo1 = Vector4LFO()
lfo1.period = 0.4
lfo2 = Vector4LFO()
lfo2.period = 0.149
self.lightFader = Vector4Shader()

#First we multiply lfo1 by lfo2, and place the result in
#the temporary register _r1
self.lightFader.addOp( _mul, _r1, lfo1, lfo2 )

#Then we multiply the light fader animation to _r1, placing
#the result in _r0 ( the final output register )
self.lightFader.addOp( _mul, _r0, self.lightFaderAnim, _r1 )

self.light.source = source.model.root
self.light.visible = 1
self.light.shader = self.lightFader

Member Function Documentation

def addOp( self, opcode, outreg, param1, param2 ):

One parameter: 0 - MOVE 1 - RECIPROCAL 2 - BIAS 3 - COMPLEMENT

Two parameters: 4 - MULTIPLY 5 - DIVIDE 6 - ADD 6 - SUBTRACT 7 - DOT 8 - MIN 9 - MAX 10 - SGE 11 - SLT

Parameters:
opcode | One of the above values as an uint8
outreg | Temporary output register as Vector4ProviderPtr to store result
param1 | First parameter as Vector4ProviderPtr
param2 | Optional second parameter as Vector4ProviderPtr, used as required


Vector4Swizzle - BigWorld cell Documentation

Vector4Swizzle Class Reference

[Math Module]

Vector4Swizzle is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

w | Read-Write Vector4Provider
x | Read-Write Vector4Provider
y | Read-Write Vector4Provider
z | Read-Write Vector4Provider

Detailed Description

The Vector4Swizzle class takes four Vector4Providers and combines the x component of each into a single Vector4Provider.

A new Vector4Swizzle is created using Math. Vector4Swizzle method.

Attribute Documentation

w

Type:
Read-Write Vector4Provider

x

Type:
Read-Write Vector4Provider

y

Type:
Read-Write Vector4Provider

z

Type:
Read-Write Vector4Provider


Vector4Translation - BigWorld cell Documentation

Vector4Translation Class Reference

[Math Module]

Vector4Translation is part of the Math module. More...

import Math

Parent Classes

Vector4Provider → PyObjectPlus

Attributes

source Read-Write Vector4

Detailed Description

This is a subclass of Vector4Provider. This provides a Vector4 value that returns the translation part of the source Matrix.

Code Example:
# This creates a Vector4 that returns the position of the players
# head node.

# import the Math module
import Math

v = Math.Vector4Translation()
v.source = BigWorld.player().model.node("biped Head")

Attribute Documentation

source

Type:
Read-Write Vector4


 BigWorld CellApp

Actualised Classes

Modules
BWConfig
BWPersonality
BigWorld
Math
ResMgr
Class List
BaseEntityMailBox
BaseViaCellMailBox
CellEntityMailBox
CellViaBaseMailBox
ClientCaller
DataSection
Entity
Matrix
MatrixInverse
MatrixProduct
MatrixProvider
Plane
PyClient
PyEntities
PyObjectPlus
PyOutputWriter
PySTLSequence
RemoteEntityMethod
ServerEntityMailBox
SharedData
UserDataObject
Vector2
Vector3
Vector4
Vector4Animation
Vector4Basic
Vector4Combiner
Vector4Distance
Vector4LFO
Vector4MatrixAdaptor
Vector4Morph
Vector4Product
Vector4Provider
Vector4Shader
Vector4Swizzle
Vector4Translation