• How do I 'keep upright' on an entity through lua?
    4 replies, posted
I want to spawn a prop with this attribute.
[CODE]local ent = ents.Create("ent_name") ent:SetPos(Player:GetEyeTrace().HitPos+ent:OBBCenter()) ent:SetAngles(Angle(0,0,0)) ent:Spawn()[/CODE] or maybe ent:SetAngles(Player:GetAngles()); im not really sure, im new to lua.
Find garrysmod/lua/autorun/properties/keep_upright.lua and find how to do it. I think it's [CODE]local Phys = ent:GetPhysicsObjectNum( 0 ) if ( !IsValid( Phys ) ) then return end local constraint = constraint.Keepupright( ent, Phys:GetAngles(), 0, 999999 )[/CODE]
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/autorun/properties/keep_upright.lua[/url] [editline]25th February 2014[/editline] ninjad
The command is: constraint.Keepupright( ) which is done server-side when you spawn the entity. [url]http://wiki.garrysmod.com/page/constraint/Keepupright[/url] Although, I've heard it may not be working correctly. Edit wow: I must've kept this page open for a while before responding, didn't see the previous 2 O_o
Sorry, you need to Log In to post a reply to this thread.