Type Hologram
Holograms
Methods
| disableShading( disableShading ) | Disables or enables shading on a hologram. |
| drawModel() | Draws the hologram's model, if executing within a render callback. |
| followBone( parent, boneID ) | Parents this hologram to the specified entity's bone. |
| getBoneAngles( bone ) | Returns the angles value for the given bone, if the given bone is valid and this hologram belongs to the instance owner. |
| getBoneOffset( bone ) | Returns the offset value for the given bone, if the given bone is valid and this hologram belongs to the instance owner. |
| getBoneScale( bone ) | Returns the scale value for the given bone, if the given bone is valid and this hologram belongs to the instance owner. |
| getClip( index ) | Returns the clipping plane that was set on the given index, if it exists. |
| getDTVar( type, index ) | Gets the value of the given DTVar, if this hologram belongs to the instance owner. |
| getDefaultRenderBounds() | Returns the default render bounds based on the hologram's current model and scale. |
| getFlexes() | Returns a table of flexname -> flexid pairs for use in flex functions. |
| getParent() | Returns the parent of this hologram, if it has one. |
| getRenderBounds() | Returns the hologram's current render bounds, taking into account bounds set by Hologram:SetRenderBounds(). |
| getRenderGroup() | Returns the hologram's current render group, if set. |
| getScale() | Gets the current scale of the hologram, if this hologram belongs to the instance owner. |
| isBoneJiggle( bone ) | Returns the jiggle value for the given bone, if the given bone is valid and this hologram belongs to the instance owner. |
| isDrawTranslucent() | Indicates whether the hologram is set to render in the translucent render pass. |
| isShadingDisabled() | Indicates whether shading has been disabled for the given hologram. |
| remove() | Removes the hologram from the world. |
| removeHalo() | Removes the halo from the hologram, if it has one. |
| setAngVel( angularVelocity ) | Sets the hologram's angular velocity. |
| setAnim( anim, cycle, rate ) | Sets the animation for the given hologram. |
| setBoneAngles( bone, angles ) | Sets the angles of the given hologram's bone. |
| setBoneJiggle( bone, enabled ) | Sets whether the given bone has jiggle enabled or not. |
| setBoneOffset( bone, offset ) | Sets the position of the given hologram's bone. |
| setBoneScale( bone, scale ) | Sets the scale of a bone. |
| setClip( index, enabled, origin, normal, localToEntity ) | Updates a clip plane, which cuts the hologram's visuals. |
| setDTVar( type, index, value ) | Sets a DataTable variable on the hologram. |
| setDrawTranslucent( drawTranslucent ) | Sets whether the hologram should be forced to draw in the translucent render pass. |
| setFlexScale( scale ) | Sets the scale of all flexes of a hologram |
| setFlexWeight( flexID, weight ) | Sets the weight (value) of a flex. |
| setLOD( level ) | Sets the level of detail for the given hologram. |
| setMaterialOverride( mat ) | Sets the material to use to override the hologram's networked material name. |
| setModel( model ) | Sets the model of the hologram. |
| setNoDraw( noDraw ) | Sets whether the hologram should be flagged as not drawing, which leaves it invisible. |
| setParent( parent, attachment ) | Parents this hologram to the specified entity. |
| setPoseParameter( key, value ) | Sets the pose parameter on the given hologram. |
| setRenderBounds( mins, maxs ) | Sets an override on the hologram's render bounds, altering the hologram's visibility and available space to render additional elements in its render callback. |
| setRenderCallback( callback ) | Sets or removes the render callback for the hologram. |
| setRenderFX( effect ) | Sets the render FX for the hologram. |
| setRenderGroup( renderGroup ) | Sets the render group in which the hologram will be drawn. |
| setRenderMesh( mesh ) | Sets a mesh to be used as the hologram's model. |
| setScale( scale ) | Sets the hologram scale, either a number, vector or matrix. |
| setVel( velocity ) | Sets the hologram's linear velocity. |
Methods
- Hologram:disableShading( disableShading )
-
Disables or enables shading on a hologram.
Environment:
SharedParameters:
-
(boolean | nil) disableShading: Whether to suppress shading on the hologram. Pass nil to reset to the default behaviour.
Return values:
-
(boolean)True if the shading was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:drawModel()
-
Draws the hologram's model, if executing within a render callback.
Environment:
ClientReturn values:
-
(boolean)True if the hologram was rendered, false otherwise. -
(string)If the hologram was not rendered, the reason why.
-
- Hologram:followBone( parent, boneID )
-
Parents this hologram to the specified entity's bone.
Environment:
ServerParameters:
-
(Entity) parent: The parent entity to attach to. -
(number) boneID: The ID of the bone to attach to.
Return values:
-
(boolean)True if the parent was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:getBoneAngles( bone )
-
Returns the angles value for the given bone, if the given bone is valid and this hologram belongs to the instance owner.
Environment:
SharedParameters:
-
(number | string) bone: Bone index or string name.
Return values:
-
(Angle | nil)The angle value for the given bone, or nil if the angles are not available. -
(string)If the angles are not available, the reason why.
-
- Hologram:getBoneOffset( bone )
-
Returns the offset value for the given bone, if the given bone is valid and this hologram belongs to the instance owner.
Environment:
SharedParameters:
-
(number | string) bone: Bone index or string name.
Return values:
-
(Vector | nil)The offset value for the given bone, or nil if the offset is not available. -
(string)If the offset is not available, the reason why.
-
- Hologram:getBoneScale( bone )
-
Returns the scale value for the given bone, if the given bone is valid and this hologram belongs to the instance owner.
Environment:
SharedParameters:
-
(number | string) bone: Bone index or string name.
Return values:
-
(Vector | nil)The scale value for the given bone, or nil if the scale is not available. -
(string)If the scale is not available, the reason why.
-
- Hologram:getClip( index )
-
Returns the clipping plane that was set on the given index, if it exists.
Environment:
SharedParameters:
-
(number) index: The unique index value, must be a number between 1 and 16.
Return values:
-
(HologramClip | nil)The clipping plane for the given index, or nil if no plane has been set or is otherwise inaccessible. -
(string | nil)If the clipping plane was nil, the reason why.
-
- Hologram:getDTVar( type, index )
-
Gets the value of the given DTVar, if this hologram belongs to the instance owner. For the index: Float, Int and Vector are between 1 and 31, Entity is between 1 and 30, String is between 1 and 4, all others are between 1 and 32.
Environment:
SharedParameters:
-
(string) type: The type of variable. Valid types are: Angle, Bool, Entity, Int, Float, String, Vector -
(number) index: The index of the DTVar.
Return value:
(boolean | number | string | Angle | Entity | Vector | nil)The current value of the DTVar. -
- Hologram:getDefaultRenderBounds()
-
Returns the default render bounds based on the hologram's current model and scale.
Environment:
ClientReturn values:
-
(Vector | nil)The minimum bounds of the hologram's default render bounds, or nil if the render bounds are not available. -
(Vector | string)The maximum bounds of the hologram's default render bounds, or the reason why the bounds are not available.
-
- Hologram:getFlexes()
-
Returns a table of flexname -> flexid pairs for use in flex functions. These IDs become invalid when the hologram's model changes.
Environment:
SharedReturn value:
(tableThe flexes for this hologram, if available. Otherwise nil.| nil) - Hologram:getParent()
-
Returns the parent of this hologram, if it has one.
Environment:
Shared - Hologram:getRenderBounds()
-
Returns the hologram's current render bounds, taking into account bounds set by Hologram:SetRenderBounds().
Environment:
ClientReturn values:
-
(Vector | nil)The minimum bounds of the hologram's current render bounds, or nil if the render bounds are not available. -
(Vector | string)The maximum bounds of the hologram's current render bounds, or the reason why the bounds are not available.
-
- Hologram:getRenderGroup()
-
Returns the hologram's current render group, if set.
Environment:
SharedReturn values:
-
(number | nil)The render group of the hologram if set, or -1 if the engine is controlling the render group, or nil if the render group could not be retrieved. -
(string)If the render group could not be retrieved, the reason why.
-
- Hologram:getScale()
-
Gets the current scale of the hologram, if this hologram belongs to the instance owner.
Environment:
SharedReturn value:
(number | Vector | VMatrix | nil)The scale assigned to the hologram (may be a number, vector or matrix). - Hologram:isBoneJiggle( bone )
-
Returns the jiggle value for the given bone, if the given bone is valid and this hologram belongs to the instance owner.
Environment:
SharedParameters:
-
(number | string) bone: Bone index or string name.
Return values:
-
(boolean | nil)The jiggle value for the given bone, or nil if the jiggle is not available. -
(string)If the jiggle is not available, the reason why.
-
- Hologram:isDrawTranslucent()
-
Indicates whether the hologram is set to render in the translucent render pass. Note that on the server this only represents the state of the networked flag, it does not account for any client-side override.
Environment:
SharedReturn value:
(boolean)True if the hologram is set to render in the translucent render pass, false otherwise. - Hologram:isShadingDisabled()
-
Indicates whether shading has been disabled for the given hologram. Note that on the server this only represents the state of the networked flag, it does not account for any client-side override.
Environment:
SharedReturn value:
(boolean)True if the hologram has disabled shading, false otherwise. - Hologram:remove()
-
Removes the hologram from the world. It cannot be used again after this operation.
Environment:
ServerReturn values:
-
(boolean)True if the hologram was removed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:removeHalo()
-
Removes the halo from the hologram, if it has one.
Environment:
ClientReturn value:
(boolean)True if the hologram had a halo which has been removed, false otherwise. - Hologram:setAngVel( angularVelocity )
-
Sets the hologram's angular velocity.
Environment:
ServerParameters:
-
(Angle) angularVelocity: Angular velocity.
Return values:
-
(boolean)True if the angular velocity was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setAnim( anim, cycle, rate )
-
Sets the animation for the given hologram.
Environment:
SharedParameters:
-
(number | nil) anim: Animation enum/sequence number, or nil to stop animating. -
(number?) cycle: (Optional) How far through the animation to start (between 0 and 1, default = 0). -
(number?) rate: (Optional) Playback rate for the animation (default = 1).
Return values:
-
(boolean)True if the animation was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setBoneAngles( bone, angles )
-
Sets the angles of the given hologram's bone.
Environment:
SharedParameters:
-
(number | string) bone: Bone index or string name. -
(Angle) angles: The angles (relative to the bone) to apply.
Return values:
-
(boolean)True if the angles were changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setBoneJiggle( bone, enabled )
-
Sets whether the given bone has jiggle enabled or not.
Environment:
SharedParameters:
-
(number | string) bone: Bone index or string name. -
(boolean) enabled: True if the bone's jiggle should be enabled, false otherwise.
Return values:
-
(boolean)True if the bone jiggle was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setBoneOffset( bone, offset )
-
Sets the position of the given hologram's bone.
Environment:
SharedParameters:
-
(number | string) bone: Bone index or string name. -
(Vector) offset: The offset (relative to the bone) to apply.
Return values:
-
(boolean)True if the offset was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setBoneScale( bone, scale )
-
Sets the scale of a bone.
Environment:
SharedParameters:
-
(number | string) bone: Bone index or string name. -
(Vector) scale: Vector scale value.
Return values:
-
(boolean)True if the scale was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setClip( index, enabled, origin, normal, localToEntity )
-
Updates a clip plane, which cuts the hologram's visuals. Note that while the index range accepts up to 16 clips, the amount that can be drawn simultaneously depends on the client operating system. Windows can render up to 6 planes, while Linux/macOS can only render 2.
Environment:
SharedParameters:
-
(number) index: The unique index value, must be a number between 1 and 16. -
(boolean) enabled: Whether to enable or disable the clipping plane. -
(Vector?) origin: The position of the clipping plane (required only if the plane is enabled). -
(Vector?) normal: The normal pointing outwards from the clipping plane (required only if the plane is enabled). -
(boolean | Entity?) localToEntity: If passed an entity, the clipping plane will be local to the given entity. If passed true, the clipping plane will be local to the hologram. Otherwise, the clipping plane will be in world space. Required only if the plane is enabled.
Return values:
-
(boolean)True if the clipping plane was changed, false otherwise. -
(string | nil)If the operation failed, the reason why.
-
- Hologram:setDTVar( type, index, value )
-
Sets a DataTable variable on the hologram. These are automatically synced between the server and the client. For the index: Float, Int and Vector are between 1 and 31, Entity is between 1 and 30, String is between 1 and 4, all others are between 1 and 32. For entities, use ents.NULL_ENTITY to reset the value.
Environment:
ServerParameters:
-
(string) type: The type of variable. Valid types are: Angle, Bool, Entity, Int, Float, String, Vector -
(number) index: The index of the DTVar. -
(boolean | number | string | Angle | Entity | Vector) value: The value to set.
Return values:
-
(boolean)True if the DTVar was updated, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setDrawTranslucent( drawTranslucent )
-
Sets whether the hologram should be forced to draw in the translucent render pass. Note that this occurs automatically if the hologram's alpha drops below 255. Consider using Hologram:setRenderGroup() instead for more granular control over rendering when using a render callback.
Environment:
SharedParameters:
-
(boolean | nil) drawTranslucent: Boolean indicating whether to draw in the translucent pass. Pass nil to reset to the default behaviour.
Return values:
-
(boolean)True if the translucent flag was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setFlexScale( scale )
-
Sets the scale of all flexes of a hologram
Environment:
ServerParameters:
-
(number) scale: Scale to apply to flexes.
Return values:
-
(boolean)True if the flex scale was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setFlexWeight( flexID, weight )
-
Sets the weight (value) of a flex.
Environment:
SharedParameters:
-
(number) flexID: The index of the flex. -
(number) weight: The weight to set.
Return values:
-
(boolean)True if the flex weight was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setLOD( level )
-
Sets the level of detail for the given hologram.
Environment:
ClientParameters:
-
(number) level: A number between 0 and 8 for fixed quality (0 being highest quality), or -1 for automatic based on distance.
Return values:
-
(boolean)True if setting the LOD succeeded, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setMaterialOverride( mat )
-
Sets the material to use to override the hologram's networked material name. This can be used to set a render target as the material for a hologram, which combined with setRenderMesh can allow for procedurally generated models. Note that setting a render target as the material requires the USE_RENDER_TARGET_MATERIALS_WITH_HOLOGRAMS permission. If the material being used is translucent or transparent, call Hologram:setDrawTranslucent( true ) and consider changing the render mode (e.g. to RENDERMODE_GLOW).
Environment:
ClientParameters:
-
(IMaterial | RenderTarget) mat: The material instance (IMaterial or RenderTarget) to apply. Pass nil to remove the override.
Return values:
-
(boolean)True if setting the material override succeeded, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setModel( model )
-
Sets the model of the hologram.
Environment:
ServerParameters:
-
(string) model: Model path.
Return values:
-
(boolean)True if the model was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setNoDraw( noDraw )
-
Sets whether the hologram should be flagged as not drawing, which leaves it invisible.
Environment:
SharedParameters:
-
(boolean) noDraw: Whether the hologram should be flagged not to draw.
Return values:
-
(boolean)True if the no draw flag was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setParent( parent, attachment )
-
Parents this hologram to the specified entity.
Environment:
ServerParameters:
-
(Entity) parent: The parent entity to attach to. -
(string?) attachment: Optional attachment name to attach to.
Return values:
-
(boolean)True if the parent was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setPoseParameter( key, value )
-
Sets the pose parameter on the given hologram.
Environment:
SharedParameters:
-
(number | string) key: The pose parameter ID or name to set. -
(number) value: The value to set on the given pose parameter.
Return values:
-
(boolean)True if the pose was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setRenderBounds( mins, maxs )
-
Sets an override on the hologram's render bounds, altering the hologram's visibility and available space to render additional elements in its render callback. These bounds will be clamped based on the maximum allowed hologram size. The returned bounds represent the final clamped bounds.
Environment:
ClientParameters:
-
(Vector | nil) mins: The minimum bounds to set, or nil to reset to the default. Components of this vector must be less-equal the provided maximum bounds. -
(Vector | nil) maxs: The maximum bounds to set, or nil to reset to the default. Components of this vector must be greater-equal the provided minimum bounds.
Return values:
-
(Vector | nil)The new minimum bounds of the hologram's render bounds, or nil if the render bounds were not changed. -
(Vector | string)The new maximum bounds of the hologram's render bounds, or the reason why the render bounds were not changed.
-
- Hologram:setRenderCallback( callback )
-
Sets or removes the render callback for the hologram. The provided callback function will be invoked with the hologram, and a bitflag indicating the type of rendering being performed (see render.STUDIO_*). Note that the hologram's model will not render unless the callback invokes Hologram:drawModel(). All clipping, lighting and material overrides will be applied to whatever is rendered in the callback. This callback may be invoked multiple times per frame, depending on the render group of the hologram, and whether water reflections are being drawn.
Environment:
SharedParameters:
-
(function | nil) callback: The callback to set as the render callback, or nil to reset rendering back to the default behaviour.
Usage:
Holo:setRenderCallback( function( Holo, Flags ) if bit.band( Flags, render.STUDIO_TRANSPARENCY ) ~= 0 then -- Render translucent pass (e.g. sprites). render.setMaterial( SpriteMaterial ) render.drawSprite( Holo:pos(), 64, 64, White ) -- If the hologram has translucent materials, also render its model here. The engine will handle rendering -- only the translucent parts. else -- Render opaque pass (e.g. the hologram's opaque model). Holo:drawModel() end end )
Return values:
-
(boolean)True if the render callback was updated, false otherwise. -
(string)If the render callback was not updated, the reason why.
-
- Hologram:setRenderFX( effect )
-
Sets the render FX for the hologram.
Environment:
ServerParameters:
-
(number) effect: Effect index.
Return values:
-
(boolean)True if the render FX was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setRenderGroup( renderGroup )
-
Sets the render group in which the hologram will be drawn. This can be used to customise at what point in the rendering process the hologram's render callback is invoked. Note that Hologram:setDrawTranslucent() overrides this value.
Environment:
ClientParameters:
-
(number | nil) renderGroup: The render group to set, or nil to reset to the default render group. If not nil, must be one of render.RENDERGROUP_OPAQUE, render.RENDERGROUP_TRANSLUCENT or render.RENDERGROUP_BOTH.
Return values:
-
(boolean)True if the render group was updated, false otherwise. -
(string)If the render group was not updated, the reason why.
-
- Hologram:setRenderMesh( mesh )
-
Sets a mesh to be used as the hologram's model. This will override the hologram's original model. Note that a material must be set, either on the server or by using setMaterialOverride(), otherwise the mesh will render as a wireframe. Make sure to set the original model to one with an idle sequence that has no rotation, otherwise the mesh will not render correctly. One such model is "models/error.mdl". Note that this requires the DRAW_MESH_HOLOGRAMS permission.
Environment:
ClientParameters:
-
(IMesh) mesh: The IMesh to use as the hologram's model. Pass nil to remove the mesh.
Return values:
-
(boolean)True if setting the mesh succeeded, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setScale( scale )
-
Sets the hologram scale, either a number, vector or matrix. Matrix scales use only the first 3x3 components.
Environment:
ServerParameters:
-
(number | Vector | VMatrix) scale: Either a number scale, vector scale or matrix scale.
Return values:
-
(boolean)True if the scale was changed, false otherwise. -
(string)If the operation failed, the reason why.
-
- Hologram:setVel( velocity )
-
Sets the hologram's linear velocity.
Environment:
ServerParameters:
-
(Vector) velocity: Velocity to apply.
Return values:
-
(boolean)True if the velocity was changed, false otherwise. -
(string)If the operation failed, the reason why.
-