Help locating tank turret issue on vehicle entry

A Forum Thread for Garry's Mod 13

Attention Gamer! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending FoxerMod points.
  • Post: Give FoxerMod your thoughts on this Thread.
  • Flag: Alert moderators and warn members of a problem with this Thread.
  • Watch: Get notified when this Thread is updated.

Resistance is futile...

Sign up

Already a Bananite? Login

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 Offline
Member Joined 3y
121 points Ranked 25485th

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



Date Added
Date Modified
7mo tracking pixel