I am trying to use a Boiler object in my game mode,but it always spawns partway in ground, I know it can be raised through lua, but I can’t see how.
Are you spawning the object yourself? If you post the code you use to get the spawning position I’ll change it to make it work.
While testing I am spawning through ent_create, it will be placed via hammer once I am finished my gamemode and made some maps for
Ah I see, here :
[lua]local multiplier = 1
local tr = ply:GetEyeTrace()
local ent = ents.Create(arg)
if arg then ent:SetModel(arg) end
ent:SetPos(tr.HitPos + tr.HitNormal * ent:BoundingRadius() multiplier)
This should do the trick, this adds a console command with the first argument being the class name and second (optional) the model. If the entity still spawns in the ground use a higher multiplier.
Thankyou, that is perfect
problem is, ent:BoundingRadius() seems to be returning 0