Class: MapObject

MapObject

Element movable in local map

new MapObject (system, position, isHero)

Name Type Description
system SystemObject The system informations
position THREE.Vector3 The current object position
isHero boolean Indicate if the object is the hero
Properties:
Name Type Argument Default Description
MapObject.SPEED_NORMAL number <optional>
0.004666 Normal speed coef
system SystemObject The system infos
position THREE.Vector3 The current object position
previousPosition THREE.Vector3 The previous position before last move
mesh THREE.Mesh The current mesh used for this object
meshBoundingBox Array.<THREE.Mesh> The meshs bounding box used for collisions
currentBoundingBox THREE.Mesh The current bounding box mesh
boundingBoxSettings Object The bounding box settings
frame Frame The animation move frame
orientationEye Orientation Orientation where the character is looking at
orientation Orientation The orientation according to camera
width number The width by number of squares
height number The height by number of squares
moving boolean Indicate if the object is moving
moveFrequencyTick number The move frequency tick
isHero boolean Indicate if this obejct is the hero
isStartup boolean Indicate if this object is a startup
isInScene boolean Indicate if this object mesh is in the scene
receivedOneEvent boolean Indicate if this object receive one event per frame
movingState Object The current state (for moving command)
previousOrientation Orientation The previous orientation before last move
otherMoveCommand EventCommandMoveObject The other move command for calculating diagonal move
yMountain number The last y mountain pixel
properties Array.<number> The properties values according to ID
statesInstance Array.<Object> The states instances values according to ID
timeEventsEllapsed Array.<Array.<any>> Informations about time events
states Array.<number> The states IDs
currentState SystemObjectState The current system object state
currentStateInstance Object The current instance object state
speed SystemValue Speed coef
frequency SystemValue Frequency value

Methods

MapObject.updateObjectWithID (object, objectID, base, callback) asyncstatic

Update the object with a particular ID
Name Type Description
object MapObject This object
objectID number The object ID searched
base Object The base module for the callback
callback function The function to call after having found the object

MapObject.getObjectAndPortion (object, objectID, base, callback) asyncstatic

Get the direct object and portion
Name Type Description
object MapObject This object
objectID number The object ID searched
base Object The base module for the callback
callback function The function to call after having found the object

initializeProperties ()

Initialize objet properties

initializeTimeEvents ()

Initialize time events (reactions to event time)

updateTimeEvents ()

Update time events

changeState ()

Update the current state (graphics to display), also update the mesh

read (json)

Read the JSON associated to the object
Name Type Description
json Object Json object describing the object

getFuturPosition (orientation, distance, angle)THREE.Vector3

Simulate moving object position
Name Type Description
orientation Orientation The orientation to move
distance number The distance
angle number The angle
Returns:
Type Description
THREE.Vector3

checkCollisionObject (object)boolean

Check collision with another object
Name Type Description
object MapObject The other map object
Returns:
Type Description
boolean

checkCollisionDetection ()THREE.Vector3

Check the collision detection
Returns:
Type Description
THREE.Vector3

isInRect (object)boolean

Check if two objects can be in the same floor rect (need test collision)
Name Type Description
object MapObject The other map object
Returns:
Type Description
boolean

updateBB (position)

Only updates the bounding box mesh position
Name Type Description
position THREE.Vector3 Position to update

updateBBPosition (position)

Only updates the bounding box mesh position
Name Type Description
position THREE.Vector3 Position to update

move (orientation, limit, angle, isCameraOrientation)Array.<number>

Move the object (one step)
Name Type Description
orientation Orientation Orientation to move
limit number Max distance to go
angle number The angle
isCameraOrientation number Indicate if this should take account of camera orientation
Returns:
Type Description
Array.<number>

teleport (position)

Teleport the object
Name Type Description
position THREE.Vector3 Position to teleport

removeMoveTemp ()

Remove datas move temp

addMoveTemp ()

Add to datas move temp

addToScene ()

Add object mesh to scene

addBBToScene ()

Add bounding boxes mesh to scene

removeFromScene ()

remove object mesh from scene

removeBBFromScene ()

Remove bounding boxes mesh from scene

receiveEvent (sender, isSystem, eventID, parameters, states, event)boolean

Receive an event
Name Type Description
sender MapObject The sender of this event
isSystem boolean Indicate if it is an event system
eventID number The event ID
parameters Array.<SystemParameter> List of all the parameters
states Array.<number> List of all the current states of the object
event Array.<number> The time events list
Returns:
Type Description
boolean

update (angle)

Update according to camera angle
Name Type Description
angle number The camera angle

updateMovingState ()

Update moving state

updateAngle (angle)

Update sprite faces angles
Name Type Description
angle number The camera angle

updateOrientation ()

Update the orientation according to the camera position

updateUVs ()

Update the UVs coordinates according to frame and orientation

updateMaterial ()

Update the material

getStateIndex ()number

Get the state index
Returns:
Type Description
number

isNone ()boolean

Check if graphics is none
Returns:
Type Description
boolean