Cafu Engine
ComponentModelT Class Reference

This component adds a 3D model to its entity. More...

Inheritance diagram for ComponentModelT:

Public Member Functions

number GetNumAnims ()
 Returns the number of animation sequences in this model. More...
 
number GetNumSkins ()
 Returns the number of skins in this model. More...
 
GuiImplT GetGui ()
 Returns the (first) GUI of this model. More...
 
- Public Member Functions inherited from ComponentBaseT
any get (string var_name)
 Returns the value of an attribute (a member variable) of this class. More...
 
 set (string var_name, any new_value)
 Sets an attribute (a member variable) of this class to a new value. More...
 
string GetExtraMessage (string var_name)
 Returns the result of VarBaseT::GetExtraMessage() for the given member variable. More...
 
 interpolate (string var_name, number start_value, number end_value, number time)
 Schedules a value for interpolation between a start and end value over a given period of time. More...
 
EntityT GetEntity ()
 Returns the entity that this component is a part of (or nil if the component is currently "stand-alone", not a part of any entity). More...
 
 InitClientApprox (string VarName)
 Registers the given attribute (a member variable) of this class for interpolation over client frames in order to bridge the larger intervals between server frames. More...
 
 OnInit ()
 This method is called for each component of each entity as the last step of initializing a newly loaded map. More...
 
 OnClientFrame (number t)
 This method is called for each component of each entity before the client renders the next frame. More...
 

Public Attributes

boolean Show
 Whether the model is currently shown (useful with scripts). More...
 
string Name
 The file name of the model. More...
 
number Animation
 The animation sequence number of the model. More...
 
number Skin
 The skin used for rendering the model. More...
 
number Scale
 The scale factor applied to the model coordinates when converted to world space. More...
 
string Gui
 The file name of the GUI to be used with the models GUI fixtures (if there are any). More...
 
boolean IsSubmodel
 Is this model a submodel of another model? If set, the pose of this model is aligned with the first "non-submodel" in the entity. More...
 
boolean Is1stPerson
 Is this a 1st-person view model? If true, the model is rendered if the world is rendered from this entity's perspective. More...
 

Event Handlers (Callbacks)

See the Event Handlers (Callbacks) overview page for additional information about the methods in this group.

tuple OnAnimationChange (int AnimNr)
 This method is called when a new animation sequence number is set for this model. More...
 
 OnSequenceWrap_Sv ()
 This method is called when playing the model's current animation sequence "wraps". More...
 
 OnSequenceWrap ()
 This method is called when playing the model's current animation sequence "wraps". More...
 

Detailed Description

This component adds a 3D model to its entity.

Models can be used to add geometric detail to a map. Some models also have ready-made "GUI fixtures" where scripted GUIs can be attached that players can interact with. Use the CaWE Model Editor in order to import mesh and animation data for models, and to prepare them for use in game maps.

Note that the variables of this class (also referred to as "Public Attributes" or "Member Data") must be used with the get() and set() methods at this time – see get() and set() for details.

If you would like to create a new component of this type explicitly (those defined in the CaWE Map Editor are instantiated automatically), use WorldT::new():

local comp = world:new("ComponentModelT")
Implementing C++ Class:
cf::GameSys::ComponentModelT

Member Function Documentation

GuiImplT GetGui ( )

Returns the (first) GUI of this model.

number GetNumAnims ( )

Returns the number of animation sequences in this model.

number GetNumSkins ( )

Returns the number of skins in this model.

tuple OnAnimationChange ( int  AnimNr)

This method is called when a new animation sequence number is set for this model.

OnSequenceWrap ( )

This method is called when playing the model's current animation sequence "wraps".

OnSequenceWrap_Sv ( )

This method is called when playing the model's current animation sequence "wraps".

Member Data Documentation

number Animation

The animation sequence number of the model.

Related C++ type:
int
string Gui

The file name of the GUI to be used with the models GUI fixtures (if there are any).

Related C++ type:
std::string
boolean Is1stPerson

Is this a 1st-person view model? If true, the model is rendered if the world is rendered from this entity's perspective.

If false, the model is rendered when seen from the outside, i.e. in everybody else's view. The default is false, because true is normally only used with the human player's 1st-person carried weapon models.

Related C++ type:
bool
boolean IsSubmodel

Is this model a submodel of another model? If set, the pose of this model is aligned with the first "non-submodel" in the entity.

Related C++ type:
bool
string Name

The file name of the model.

Related C++ type:
std::string
number Scale

The scale factor applied to the model coordinates when converted to world space.

Related C++ type:
float
boolean Show

Whether the model is currently shown (useful with scripts).

Related C++ type:
bool
number Skin

The skin used for rendering the model.

Related C++ type:
int