Servo: Disabling gravity of constrained objs

I’m making a 3D servo sphere that can rotate around X, Y , and Z. it works except for the fact that objects welded/etc too it, still have gravity enabled, and therefore affect the rotation of the servo.

How do i disable gravity for objects welded to the servo? Or is there a better way?

Heres the code if it’s important

init.lua

[lua]–[[---------------------------------------------------------
Name: Initialize
Desc: First function called. Use to set up your entity
---------------------------------------------------------]]
function ENT:Initialize()

self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )

local phys = self:GetPhysicsObject()
phys:EnableGravity( 0 )
phys:EnableDrag( 0 )
phys:Sleep()

self.Entity:StartMotionController()

self.Speed = 100
self.X = 0
self.Y = 0
self.Z = 0

self.Inputs = Wire_CreateInputs(self.Entity, { "A: X-Go", "B: Y-Go", "C: Z-Go"})

end

–[[---------------------------------------------------------
Speed
---------------------------------------------------------]]
function ENT:SetSpeed( speed )

self.Speed = speed

end

function ENT:GetSpeed( speed )

return self.Speed

end

–[[---------------------------------------------------------
Sets the ballsocket (world space)
---------------------------------------------------------]]
function ENT:SetBall( vec )

self.Ball = self.Entity:GetPos() + vec * 512
self.Ball = self.Entity:NearestPoint( self.Ball )
self.Ball = self.Entity:WorldToLocal( self.Ball )

end

–[[---------------------------------------------------------
Name: PhysicsUpdate
Desc: Called to update the physics … or something.
---------------------------------------------------------]]
function ENT:PhysicsUpdate( physobj )

local phys = self:GetPhysicsObject()

if ( self.X == 0 and self.Y == 0 and self.Z == 0 ) then
	phys:Sleep()
else

	local aVel = -1 * phys:GetAngleVelocity()
	phys:AddAngleVelocity( aVel + Vector(self.X,self.Y,self.Z) )
end

end

–[[---------------------------------------------------------
Name: TriggerInput
Desc: the inputs
---------------------------------------------------------]]
function ENT:TriggerInput(iname, value)

local mul = value
	
local phys = self:GetPhysicsObject()
phys:Wake()
local aVel = -1 * phys:GetAngleVelocity()

if (iname == "A: X-Go") then

	-- Is this key invalid now? If so return false to remove it
	if ( !self.Entity:IsValid() ) then return false end

	mul = mul or 1
	self.X = self.Speed * mul

	
elseif (iname == "B: Y-Go") then
		
	-- Is this key invalid now? If so return false to remove it
	if ( !self.Entity:IsValid() ) then return false end

	mul = mul or 1
	self.Y = self.Speed * mul
	
elseif (iname == "C: Z-Go") then
			
	-- Is this key invalid now? If so return false to remove it
	if ( !self.Entity:IsValid() ) then return false end

	mul = mul or 1
	self.Z = self.Speed * mul

end


if ( self.X == 0 and self.Y == 0 and self.Z == 0 ) then
	phys:Sleep()
else
	phys:AddAngleVelocity( aVel + Vector(self.X,self.Y,self.Z) )
end

end[/lua]



local entities = duplicator.GetAllConstrainedEntitiesAndConstraints( servo )

for k,v in pairs(entities)do

    v:SetGravity(false)

end


So I tried putting it in ENT:Think, is that where this goes? Im gettin errors from the duplicator code:

lua\includes\modules\duplicator.lua:499: attempt to index local ‘ent’ (a nil value)

You should use something like this instead.
[lua]
for k, v in pairs(constraint.GetAllConstrainedEntities(self)) do
v:SetGravity(false);
end
[/lua]