Making some models gravgunable


i have the problem that when i create an entity with the model lets say of a potato (models/props_phx/misc/potato.mdl) then i cant pick it up with the gravity gun.

here is the init of the entity

function ENT:Initialize()
	self.Entity:SetColor( Color( 255, 255, 255, 255 ) )
	local phys = self.Entity:GetPhysicsObject()
	if phys and phys:IsValid() then phys:Wake() end
	phys:SetMass( 300 )
	self.sparking = false
	self.damage = 50

Does no one of the Lua gods in here have a clue?

I haven’t tested this, but you could mess with the

GM/GravGunPickupAllowed hook.

Nope still can’t pickup the entity. Besides even the normal model directly spawned from the menu isnt pickupable via gravity gun.

iirc the max mass for the gravgun is 200, not 300. Have you tried using a lower number?

still not “gravgunable” with a mass of 200

I wonder if it’s to do with the models size. Have you tried scaling it’s hull?

nope not tried yet but I think I don’t tried it because i don’t know how

It’s 250. It’s something to do with the model in this case, not the weight.

[editline]18th April 2015[/editline]

Try calling

		self:PhysicsInitSphere( 1 )

And do not use self.Entity. Use just self.

Thx Robotboy655 that fixed the problem.