Skip to content

Commit

Permalink
Add Entity:getRenderBounds() (#1834)
Browse files Browse the repository at this point in the history
* Add Entity:getRenderBounds()

* Edit Entity:getRenderBounds()
  • Loading branch information
friztailo authored Aug 23, 2024
1 parent 334a686 commit ce6506e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lua/starfall/libs_sh/entities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,24 @@ if CLIENT then
local ent = getent(self)
if not ent.IsSFHologram and not ent.IsSFProp then SF.Throw("The entity isn't a hologram or custom-prop", 2) end


checkpermission(instance, ent, "entities.setRenderProperty")

mins, maxs = vunwrap(mins), vunwrap(maxs)
ent:SetRenderBounds(mins, maxs)
ent.sf_userrenderbounds = {mins, maxs}
end

--- Returns render bounds of the entity as local vectors
-- If the render bounds are not inside players view, the entity will not be drawn!
-- @client
-- @return Vector The minimum vector of the bounds
-- @return Vector The maximum vector of the bounds
function ents_methods:getRenderBounds()
local ent = getent(self)
local mins, maxs = ent:GetRenderBounds()
return vwrap(mins), vwrap(maxs)
end

--- Sets the Level Of Detail model to use with this entity. This may not work for all models if the model doesn't include any LOD sub models.
-- This function works exactly like the clientside r_lod convar and takes priority over it.
-- -1 leaves the engine to automatically set the Level of Detail. The Level Of Detail may range from 0 to 8, with 0 being the highest quality and 8 the lowest.
Expand Down

0 comments on commit ce6506e

Please sign in to comment.