The Game Modding Community - Since 2001

Help locating tank turret issue on vehicle entry

A Forum Thread for Garry's Mod 13

Problem seems to be code related but possibly is a model issue.
I think the problem stems from the axis constraint in the code being ignored or nonoperational when the vehicle is entered. when spawned the turret is attached and welded in place as is the gun. On entry the gun falls off and the turret may also be thrown off with enough turning of both it and the vehicle. Since the image is not wanting to work I've just pasted the suspect bit below

function ENT:SpecialReposition()
    if (SERVER) then
        local pos = self.Entity:GetForward() * self.TowerPos.x + self.Entity:GetUp() * self.TowerPos.z
        self.Tower:SetPos( self.Entity:GetPos() + pos )
        constraint.Axis( self.Tower, self.Entity, 0, 0, Vector(0, 0, 0) , Vector(0,0,0) , 0, 0, 0, 1, Vector(0,0,1))
        self.TowerWeld = constraint.Weld( self.Tower, self.Entity, 0, 0, 0, false)
        pos = self.Tower:GetForward() * self.PipePos.x + self.Tower:GetRight() * self.PipePos.y + self.Tower:GetUp() * self.PipePos.z
        self.Pipe:SetPos( self.Tower:GetPos() + pos )
        constraint.Axis( self.Pipe, self.Tower, 0, 0, Vector(0, 0, 0) , Vector(0,0,0) , 0, 0, 0, 1, Vector(0,1,0))   
        constraint.NoCollide( self.Pipe, self.Entity, 0, 0 )   
        self.PipeWeld = constraint.Weld( self.Pipe, self.Tower, 0, 0, 0, false)

I do not have this issue following the jeepturret method like in the V92 Halftrack and the Halo Warthog. However that method does not bring in the collision mesh for the pieces and I don't know if there's a way to call the collision mesh in that way. I'd rather use the Sherman from which I got the code above since the collision meshes are brought in. Also strangely enough if I simply rename the sherman lua to my file and spawn it the issue still apples but if I spawn the Sherman from the addon it remains together despite the code being essentially the same and unaltered.

My addon with both methods is available at the WIP below, included are the lua's for the Sherman, halftrack, and Warthog so you can see where I've pulled in and what I've left out ((usually the weapons and the third seat))
Requires SCars Slim


None found


Share banner
Image URL:
HTML embed code:
BB embed code:
Markdown embed code:


FoxerMod avatar
FoxerMod Joined 3y ago
172 points Ranked 20748th

Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!



  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+


  • 0 Posts
  • 10mo Submitted
  • 15d Modified

SEX! Ok, we got your attention. Mascot

GameBanana is one of the oldest mod sites on the net. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation - send modders points.
  • Post: Give modders your thoughts on their work.
  • Vote: Help your favorite modders win monthly awards.
  • Flag: Alert moderators and warn members of problems with mods.
  • Watch: Get notified when mods are updated.

Sound fun? Sign up now!

Already a Bananite? Login

WiPs by Submitter tracking pixel