Ok so I’m making a tank and it has a turret that turns to look at the enemy but there are a couple problems I run into. Normally I would put the turret as a child of the tanks body so it can move relative with the body as it moves around but rotating the turret when parented to the body makes the turret resize so it still fits inside the parented body (See TankIncorrect Image). Next I unparented the turret from the body and I got my desired effect it rotates normally but it doesn’t stay connected to the body as the body moves away (See TankMoving Image). I’ve tried using a fixed joint on the turret to keep it on the body but when I want the turret to turn it wont because its fixed to the body. Is there a way to allow the turret to rotate while its using a fixed joint? Thanks any ideas are appreciated!!
Create a new EmptyGameObject, and make the Turret a child of it. Then make the EmptyGameObject a child of the tank and see if it work.
Close, just think you have the parenting mixed up a bit.
Use an empty game object, with a scale of (1,1,1). You make this empty object the “tank position”, and make the tank body a child of the “tank position” object, AND the turret a child of the object.
Now you can move and rotate the “tank position”, scale the body, and rotate the turret, all separately.
In general, it gets confusing to have a scaling transform as parent of a transform with a rotation, so to avoid it, I do the above almost every-time I have a scaling transform.