Garry's Mod Wiki

PositionSpawnIcon

  table PositionSpawnIcon( Entity model, Vector position, boolean noAngles )

Description

Moves the given model to the given position and calculates appropriate camera parameters for rendering the model to an icon.

The output table interacts nicely with Panel:RebuildSpawnIconEx with a few key renames.

Arguments

1 Entity model
Model that is being rendered to the spawn icon
2 Vector position
Position that the model is being rendered at
3 boolean noAngles
If true the function won't reset the angles to 0 for the model.

Returns

1 table
Table of information of the view which can be used for rendering

Example

Creates a clientside model and then PositionSpawnIcon is used to figure out the appropriate camera parameters for rendering this model.

local ent = ClientsideModel("models/props_wasteland/cafeteria_table001a.mdl", RENDERGROUP_BOTH) local tab = PositionSpawnIcon(ent, vector_origin) ent:Remove() PrintTable(tab)
Output:
angles = 25.000 220.000 0.000 fov = 8.4436927451273 origin = 1156.924316 970.773010 704.184265 zfar = 1888.5692536466 znear = 1