I have a simple custom entity that I want the player to be able to pickup when pressing use. However, it looks like the model I am using has too much mass. This is what I've tried so far:
[lua]if SERVER then AddCSLuaFile("shared.lua") end
ENT.Type = "anim"
ENT.Base = "base_anim"
if SERVER then
function ENT:Initialize()
self:SetModel("models/props_c17/consolebox01a.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if IsValid(phys) then
phys:AddGameFlag(4) -- PLAYER_HELD
phys:ClearGameFlag(32) -- HEAVY_OBJECT
phys:ClearGameFlag(128) -- NO_PLAYER_PICKUP
phys:SetMass(5)
phys:Wake()
end
end
-- ...
end
-- ...[/lua]
I tried setting / clearing some flags that looked relevant, but it still isn't working.
I tried simply using the gravity gun instead, but it is also unable to pick up the entity.
[QUOTE=Ziks;41047559]I tried simply using the gravity gun instead, but it is also unable to pick up the entity.[/QUOTE]
If that doesn't work you may need to do the TTT approach where it welds another entity to it with a ShadowMove and hook it on the use button gm hook
You might be able to use the PlayerUse hook and call player:PickupObject(ent)
The GameFlag 'player_held' might also be interfering since that's meant for the engine to do stuff to entities that are currently being held.
Sorry, you need to Log In to post a reply to this thread.