Hi. I would like to create custom ball entity. Somethink like golf ball. So i have don this and everythink is fine but my ball won't stop rolling. (It's slow rotation).
My code:
init.lua:
-- Send required files to client
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
-- Include needed files
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/XQM/Rails/gumball_1.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
phys:SetMass(100)
phys:EnableDrag(true)
phys:SetDragCoefficient( 10 )
phys:SetAngleDragCoefficient( 10 )
if phys:IsValid() then
phys:Wake()
end
end
function ENT:Think()
local ply = self:GetOwner()
ply:SetPos(self:GetPos())
self:NextThink( CurTime() )
return true
end
shared.lua
-- Entity information
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
Can you help me with that?
Sorry, you need to Log In to post a reply to this thread.