• Copy tool?
    35 replies, posted
[QUOTE=whosdr;24047063]Actually, I made a mistake in that.[/QUOTE] Oh, I see it now.
Should have persisted a local position vector with it.
[QUOTE=whosdr;24055631]Should have persisted a local position vector with it.[/QUOTE] So what is the new code i need to use? (if you could explain it all in expression 2 noob terms i would be greatful.
[lua] function ENT:Think() if not differpos then differpos = parent:GetPos()-self:GetPos() else self:SetPos(parent:GetPos()+differpos) self:SetAngles(parent:GetAngles()) local phys = self:GetPhysicsObject() local phys2 = parent:GetPhysicsObject() if phys and phys2 and phys:IsValid() and phys2:IsValid() then phys:SetVelocity(phys2:GetVelocity()) end end end [/lua]
[QUOTE=creec;24068449][lua] function ENT:Think() if not differpos then differpos = parent:GetPos()-self:GetPos() else self:SetPos(parent:GetPos()+differpos) self:SetAngles(parent:GetAngles()) local phys = self:GetPhysicsObject() local phys2 = parent:GetPhysicsObject() if phys and phys2 and phys:IsValid() and phys2:IsValid() then phys:SetVelocity(phys2:GetVelocity()) end end end [/lua][/QUOTE] So i can just stick this into the expression control pannel right?
That's lua, not E2. [code] @inputs [E1 E2]:entity @persist Local:vector if (first()) { runOnTick(1) } if (->E1 & ->E2) { if (~E1 | ~E2) {Local = E1:toLocal(E2:pos()} E2:setPos(E1:pos() +Local) E2:setAng(E1:angles()) } [/code]
Sorry, you need to Log In to post a reply to this thread.