• Entity just sits there, possibly stupid reason.
    3 replies, posted
  • Avatar of Hypershadsy
  • It's supposed to jump around after I +use it. Instead, it does nothing. It does have physics, however. cl_init.lua [lua]function ENT:Draw () self.Entity:DrawModel(); end include("shared.lua");[/lua] shared.lua [lua]ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "Jumpy" ENT.Author = "Hypershadsy" ENT.Information = "Info" ENT.Category = "Fun + Games" ENT.Spawnable = true ENT.AdminSpawnable = true[/lua] init.lua [lua]include("shared.lua") AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 16 local ent = ents.Create( "sent_test" ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end function ENT:Initialize() self.Entity:SetModel( "models/Combine_Helicopter/helicopter_bomb01.mdl" ) self.Entity:PhysicsInit( SOLID_VPHYSICS ) local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() end self.Entity:SetCollisionBounds( Vector( -16, -16, -16 ), Vector( 16, 16, 16 ) ) end function ENT:Use() timer.Create("node",1,0,function() local DirX = math.Rand(-100,100) local DirY = math.Rand(-100,100) local DirZ = math.Rand(-100,100) self.Entity:GetPhysicsObject():ApplyForceCenter( Vector( DirX, DirY, DirZ ) ) end ) end[/lua]
  • Avatar of Morcam
  • [QUOTE=Hypershadsy;21299926]Worked. Thread over[/QUOTE] For reference, gravity applies a force of 600 units * mass * deltatime. Assuming deltatime is 0.015, that's 315 units of force. Thus it doesn't move. You could disable gravity, though. Then it would fly around, rather than jump.