• Spawn on Ground
    4 replies, posted
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 concommand.Add("spawn",function(ply,cmd,arg) local tr = ply:GetEyeTrace() local ent = ents.Create(arg[1]) ent:SetAngles(ply:GetAngles()*-1) if arg[2] then ent:SetModel(arg[2]) end ent:SetPos(tr.HitPos + tr.HitNormal * ent:BoundingRadius()* multiplier) ent:Spawn() end)[/lua] 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 [editline]11:09PM[/editline] problem is, ent:BoundingRadius() seems to be returning 0
Sorry, you need to Log In to post a reply to this thread.