• Strange Effect; Invisible colision mesh + Entity not changing the model on spawn.
    1 replies, posted
Hello fp users, I'm currently developing a prop placement tool, but I have a strange problem. The effect is the next: I spawn the entity with a SWEP and, apart from the problem that the model of the entity remains the default one (what I do not want), an invisible "colision mesh" apears to be created with the default model. The code of the spawning procedure is the next: [lua] if SERVER then function SWEP:PrimaryAttack() local tr = self.Owner:GetEyeTrace(); local e = ents.Create( self.SpawnType ); e:SetPos(tr.HitPos); e:SetAngles(Angle(0,0,0)); e.Model = self.ModModel; e:SetModel( self.ModModel ); e.ResultEntity = "prop_physics"; e.NeedResources = {}; if GAMEMODE_NAME == "sandbox" then undo.Create("Assembly Buildsite"); undo.AddEntity(e); undo.SetPlayer(self.Owner); undo.Finish(); end e:Spawn(); end end [/lua] *Also* tryed changing the function to shared (Removing the if SERVER...) but nothing changes. this is the initialization procedure for the entity itself (which is derived from base_gmodentity). [lua] function ENT:Initialize() self:SetModel( self.Model ); self:SetPos( self:GetPos() ); self:PhysicsInit( SOLID_NONE ); self:SetMoveType( MOVETYPE_NONE ); self:SetSolid( SOLID_VPHYSICS ); end [/lua] Thanks for your time! :happy: edit: The solid mesh acts like a prop_physics with default movetype (MOVETYPE_VPHYSICS and SOLID_VPHYSICS) that means that I keep coliding with a "free invisible prop" that messes arround.
wrap initialize function in SERVER
Sorry, you need to Log In to post a reply to this thread.