Hello, im trying to make a moving tank with a rotating turret using tweens but the turret falls over because its not welded to the body. When i try to weld the turret to the rest of the body and then try to play the tween the turret doesnt move. So how can i make a moving tank where the turret follows the rest of the body but the turret will rotate using tweens?
Instead of welding the moving part, you can use ball and socket join to connect it so that it moves with the part while being able to rotate freely
it works when the turret is not rotating but when i play the tween the turret freezes in place and the body moves and when the tween stops it flings the turret to the body
I think it might be easier to use hinge constraints to rotate the turret instead of a tween,
You can also rotate the attachment0 that the hinge constraint uses to allow it to move in different orientations
can you tween attachments? lol
Yeah you can tween them since they have cframes which can be tweened
so if i tween that attachment could it work?
Scrap the tweening method: It’s unoptimized and unreliable. The best and most optimized way to do this is to weld all turret parts to a base part called TurretBase, which will act as the pivot of the turret:
- Weld all of your turret’s parts to TurretBase.
- Position the TurretBase in the place where you want the turret’s pivot to be.
- Weld TurretBase to the tank’s hull, so the turret won’t fall off (the PrimaryPart for example) using a NORMAL weld. (P0 = HullPart, P1 = TurretBase) (you can easily do this with a plugin that calculates
C0
for you)
With that normal weld, considering Weld.C1
is 0, 0, 0
, you can manipulate it using scripts. The whole turret will rotate accordingly. I use the same method for my game and it works perfectly.
so then how should i make the tank move?
im guessing your tank isn’t player-controlled, so use tweens
TurretBase is the basepart of your turret, weld the turret parts to that so that when TurretBase moves, the rest of the turret will move.
Get a tank hull, then use whatever method to rotate the turret and connect the Hull to the TurretBase.
There’s a “fixed mechsuit” model in the toolbox that can rotate on the server, it uses a weld to do that. I was able to retrofit it and make my own mech suit with it
So yes you can use welds to rotate
https://gyazo.com/67c14d8e513eef1a1e36d75818e08b32
I’m on mobile so I can’t get the actual model but I’m 99% sure it’s called “fixed mechsuit” with the original model being “mechsuit”
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.