class Model extends Visual (client-side)
Available since version: 0.3.8.0
This class represents a rigged model with bones that can play animations.
Properties
zarray& listOfVoiceHandles (read-only)
Represents the list of used voice handles.
Vob& homeVob (read-only)
Represents the vob that is using this model.
int lastTimeBBox3DTreeUpdate (read-only)
Represents the last frame time when zCModel::CalcNodeListBBoxWorld method was called.
BBox3d& bbox3dWorld (read-only)
Represents the bounding box 3d of model, shifted by its position in world.
BBox3d& bbox3dLocal (read-only)
Represents the bounding box 3d of model.
BBox3d& bbox3dCollDet (read-only)
Represents the bounding box 3d of model used for collision detection.
float modelDistanceToCam (read-only)
Represents the model distance to global view camera.
bool isInMobInteraction
Represents true if this model is in mob interaction, otherwise false.
float fatness
Represents model fatness ratio.
Vec3& modelScale
Represents model scale.
Vec3& aniTransScale
Represents model animation transform scale (from MDS scripts).
Vec3& rootPosLocal
Represents current model root node local position.
Vec3& vobTrans
Represents last model vob transform vector (delta position).
Vec3& vobTransRing
Represents last model vob transform ring vector.
bool newAniStarted
Represents true if new animation has started playing on model, otherwise false.
bool smoothRootNode
Represents true if smooth root node is enabled, otherwise false (vobTransRing = vobTrans).
float relaxWeight
Represents current model relax weight.
bool drawHandVisualsOnly
Represents true if only hand model parts are being rendered, otherwise false (used by firstperson).
Quat& vobRot
Represents last model vob rotation.
Vec3& modelVelocity
Represents last model velocity.
int actVelRingPos
Represents active velocity ring position.
bool isVisible
Represents true model is visible, otherwise false.
bool isFlying
Represents true model is flying, otherwise false.
bool randAnisEnabled
Represents true model is playing random animations, otherwise false.
bool lerpSamples
Represents true model lerp samples is enabled, otherwise false.
bool modelScaleOn
Represents true model scaling is enabled, otherwise false.
bool doVobRot
Represents true model rotation should be applied, otherwise `false.
bool nodeShadowEnabled
Represents true model node shadow is enabled, otherwise `false.
bool nodeShadowEnabled
Represents true model dyn light mode is enabled, otherwise `false.
float timeScale
Represents model time scale.
Methods
advanceAnis
This method will advance played animations on given model (.asc).
void advanceAnis()
velocityRing
This method returns the model velocity ring vector.
Vec3 velocityRing()
Returns Vec3:
resetVelocity
This method resets the model velocity.
void resetVelocity()
recalcRootPosLocal
This method recalculates local root node position.
void recalcRootPosLocal(bool selectHighestY = true)
Parameters:
boolselectHighestY:trueif you want to select highest y value for transformation, otherwisefalse.
getRootNodeTrans
This method returns the model root node translation (in default pose).
Vec3 getRootNodeTrans()
Returns Vec3:
startAni
This method starts playing animation on model.
void startAni(string aniName, int startMode = MODEL_STARTANI_DEFAULT)
Parameters:
stringaniName: the name of the animation.intstartMode: the model start mode.
stopAni
This method stops played animation on model.
void stopAni(string aniName)
Parameters:
stringaniName: the name of the animation.
isAniActive
This method returns true if given animation is currently played on model, otherwise false.
bool isAniActive(string aniName)
Parameters:
stringaniName: the name of the animation.
Returns bool:
isStateActive
This method returns true if given state or transition animation is currently played on model, otherwise false.
bool isStateActive(string aniName)
Parameters:
stringaniName: the name of the animation.
Returns bool:
getAniFromAniName
This method returns the model animation by given name.
ModelAni&|null getAniFromAniName(string aniName)
Parameters:
stringaniName: the name of the animation.
Returns ModelAni&|null:
getNextAni
This method returns the next model animation from given model animation.
ModelAni&|null getNextAni(ModelAni ani)
Parameters:
ModelAniani: the model animation.
Returns ModelAni&|null:
searchNode
This method returns the found model node.
ModelNodeInst&|null searchNode(string nodeName)
Parameters:
stringnodeName: the node name.
Returns ModelNodeInst&|null:
getNodeList
This method returns all nodes defined in the model.
zarray& getNodeList()
Returns zarray&:
applyMeshLib
This method applies the given mesh lib (.asc) onto model.
bool applyMeshLib(string meshName)
Parameters:
stringmeshName: the name of .asc mesh.
Returns bool:
removeMeshLib
This method removes the given mesh lib (.asc) from model.
bool removeMeshLib(string meshName)
Parameters:
stringmeshName: the name of .asc mesh.
Returns bool:
removeAllMeshLibs
This method removes all applied mesh libs (.asc) from model.
void removeAllMeshLibs()
setNodeMeshTexture
This method sets the node mesh texture.
void setNodeMeshTexture(string nodeName, int channel, int variation, string textureNamePart = null)
Parameters:
stringnodeName: the name of the node.intchannel: the id of the texture channel (e.g:C[NUM]part from texture name, e.g:HUM_HEAD_V0_C0.TGA).intvariation: the id of the texture variant (e.g:V[NUM]part from texture name, e.g:HUM_HEAD_V0_C0.TGA).stringtextureNamePart: the optional texture name part that will be used to find the specific texture.
setMeshLibTexture
This method sets the mesh lib texture
void setMeshLibTexture(string meshLibName, int channel, int variation, string textureNamePart = null)
Parameters:
stringmeshLibName: the name of the .asc model, e.g:"HUM_BODY_NAKED0".intchannel: the id of the texture channel (e.g:C[NUM]part from texture name, e.g:HUM_HEAD_V0_C0.TGA).intvariation: the id of the texture variant (e.g:V[NUM]part from texture name, e.g:HUM_HEAD_V0_C0.TGA).stringtextureNamePart: the optional texture name part that will be used to find the specific texture.
calcNodeListBBoxWorld
This method updates the bounding boxes for each model node in nodeList
void calcNodeListBBoxWorld()
calcModelBBox3DWorld
This method updates the model bbox3d
void calcModelBBox3DWorld()
getTrafoNodeToModel1
This method gets the transformation node to model matrix
Mat4 getTrafoNodeToModel1(ModelNodeInst node)
Parameters:
ModelNodeInstnode: the model node.
Returns Mat4:
getBBox3DNodeWorld
This method gets the bounding box for given model node in world space coordinates
BBox3d getBBox3DNodeWorld(ModelNodeInst node)
Parameters:
ModelNodeInstnode: the model node.
Returns BBox3d:
getNodePositionWorld
This method gets the position given model node in world space coordinates
Vec3 getNodePositionWorld(ModelNodeInst node)
Parameters:
ModelNodeInstnode: the model node.
Returns Vec3:
setNodeVisual
This method gets the position given model node in world space coordinates
Vec3 setNodeVisual(ModelNodeInst node, Visual visual, bool animated = false)
Parameters:
ModelNodeInstnode: the model node.Visualvisual: the new visual asset.boolanimated:trueif visual asset is animated format, otherwisefalse.
Returns Vec3:
getLowestLODNumPolys
This method gets the num polys count for lowest LOD model variant
int getLowestLODNumPolys()
Returns int:
getMaterial
This method gets the first material either from first mesh if there's just one, or the second if there are two for the model
Material&|null getMaterial()
Returns Material&|null:
getNumMaterials
This method gets the total number of materials used byt first mesh if there's just one, or the second if there are two for the model
int getNumMaterials()
Returns int:
attachChildVobToNode
This method attaches vob as child object for given model node in the model hierarchy
void attachChildVobToNode(Vob childVob, ModelNodeInst node)
Parameters:
VobchildVob: the vob object.ModelNodeInstnode: the model node.
removeChildVobFromNode
This method removes attached vob as child object for model node in the model hierarchy
void removeChildVobFromNode(Vob childVob)
Parameters:
VobchildVob: the vob object.
getAttachedNodeVob
This method gets attached vob as child object for model node in the model hierarchy
Vob getAttachedNodeVob(ModelNodeInst node)
Parameters:
ModelNodeInstnode: the model node.
Returns Vob:
removeAllChildVobsFromNode
This method removes all attached vob as child objects for model nodes in the model hierarchy
void removeAllChildVobsFromNode()
updateAttachedVobs
This method updates all attached vob transformations and removes vobs with dead visuals
void updateAttachedVobs()
fadeOutAnisLayerRange
This method fades out played animations on given ani layers range on model
void fadeOutAnisLayerRange(int layerLow = 2, int layerHigh = 256)
Parameters:
intlayerLow: the lowest layer range.intlayerHigh: the highest layer range.
stopOutAnisLayerRange
This method stops played animations on given ani layers range on model
void stopOutAnisLayerRange(int layerLow = 2, int layerHigh = 256)
Parameters:
intlayerLow: the lowest layer range.intlayerHigh: the highest layer range.
fadeOutAni
This method fades out given played animation on the model
void fadeOutAni(string aniName)
Parameters:
stringaniName: the animation name.
applyModelProtoOverlay
This method applies the given MDS overlay on the model
void applyModelProtoOverlay(string overlayName)
Parameters:
stringoverlayName: the mds overlay name.
hasAppliedModelProtoOverlay
This method checks if given MDS overlay was applied on the model
bool hasAppliedModelProtoOverlay(string overlayName)
Parameters:
stringoverlayName: the mds overlay name.
Returns bool:
removeModelProtoOverlay
This method removes the applied MDS overlay on the model
void removeModelProtoOverlay(string overlayName)
Parameters:
stringoverlayName: the mds overlay name.
removeAllAniAttachments
This method removes all ani attachments from the model
void removeAllAniAttachments()
removeAllVobFX
This method removes all vob visual effects from the model (e.g: particle effects)
void removeAllVobFX()
correctAniFreezer
This method tries to kill played animation that potentially caused a dead-loop (if such exists) on model
bool correctAniFreezer()
Returns bool:
insertRandAni
This method gets the random animation frequency
void insertRandAni(string aniName, string randomAniName, int probability = 1)
Parameters:
stringaniName: the name of the main animation.stringrandomAniName: the name of the animation that will be randomly played when main animation gets played.intprobability: the random probability ratio.
getRandAniFreq
This method gets the random animation frequency
float getRandAniFreq(string aniName)
Parameters:
stringaniName: the name of the animation.
Returns float:
setRandAniFreq
This method gets the random animation frequency
void setRandAniFreq(string aniName, float freq)
Parameters:
stringaniName: the name of the animation.floatfreq: the animation occurrence frequency .
Callbacks
No callbacks.