Hi everyone. Basically I never go there and I never post something - with time I find how to solve the problems I encounter. But currently it’s not the case: I found nothing for solving it. It’s easy-to-understand and I don’t think it’s complicated to solve.
I have a base entity (let’s call it ent01), with in the initialize code of it, another entity which is created (let’s call it ent02). When ent01 spawns, ent02 is automatically created and they have a constraint.Rope between them.
All seems good. The problem is that, if you don’t take the entity one time with the gravity-gun, the rope is not refreshed with the entity movement. Basically if someone moves ent02, the rope doesn’t move with for you. The only way for making you correctly see the rope is when ent01 spawns and ent02 is created where we must take ent02 with the gravity-gun for refreshing the rope… I honestly don’t understand all this shit works, but I tested several PhysObj, Grav & ENT:Physics functions… Never found how to solve this.
My problem in video (sorry about the music, it’s just a quick video showing that the rope doesn’t move with the ent02):
ent01 (the base):
function ENT:Initialize() self:SetModel("models/props_docks/dock01_pole01a_128.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) local phys = self:GetPhysicsObject() if IsValid(phys) then phys:Wake() phys:EnableMotion(false) phys:Sleep() end if CLIENT then return end local ent = ents.Create("ent_lock") if not IsValid(ent) then return end ent:SetPos(self:LocalToWorld(Vector(0, 30, 10))) ent:SetAngles(self:GetAngles() + Angle(180, 10, 45)) ent:Spawn() ent:Activate() constraint.Rope(self, ent, 0, 0, Vector(0, 0, 50), Vector(0, 0, 0), 200, 0, 0, 6, "cable/rope", false) end
ent02 (the entity which seems have like a physic problem):
function ENT:Initialize() self:SetModel("models/tpbsa/ankle_bracelet.mdl") -- it's a custom model I used from a script with one of my friends self:SetModelScale(self:GetModelScale() * 6, 0.01) self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) local phys = self:GetPhysicsObject() if IsValid(phys) then phys:Wake() end end
Other codes are just some ENT.Category, ENT.Instructions, include() and some shits. We don’t care about them since all seems good for my other entities.
How to solve my problem?
Thanks all of you,