Removing default contraint to world on weapons. (Frozen by default)
2 replies, posted
So basically I am trying to take advantage of the weapon spawns provided by maps. The main issue here is that weapons frozen by default (with weapon flags, example [URL="https://developer.valvesoftware.com/wiki/Weapon_m4a1"]here[/URL]) aren't unfrozen.
In this picture you can see the debug details being output by the [URL="http://wiki.garrysmod.com/page/PhysObj/OutputDebugInfo"]debug function[/URL]
[IMG]http://puu.sh/8g6yk.png[/IMG]
I am wondering how I can remove that controller, because I believe it is caused by the 'sys:constraint" which is the only major difference, and because it is caused by spawn flags applied by the map itself.
What methods are there to remove the constraint?
I tried constraint.RemoveAll and a few other things I have forgotten already.
[code]function SWEP:AcceptInput( name, activator, caller, data )
if ( name == "ConstraintBroken" && self:HasSpawnFlags( 1 ) ) then
local phys = self:GetPhysicsObject()
if ( IsValid( phys ) ) then phys:EnableMotion( false ) end
local newflags = bit.band( self:GetSpawnFlags(), bit.bnot( 1 ) )
self:SetKeyValue("spawnflags", newflags)
end
end[/code]
Here's what I ended up with to fix this issue.
Oh damn, had no idea you could remove spawnflags that way, thanks mate :)
Sorry, you need to Log In to post a reply to this thread.