So I've been trying to find on YT and Reddit and basically every media app and I can't seem to find help on how to make this. If you don't know what I'm talking about well basically the Smash Bro's camera takes the center of the character that is the furthest to the left and right so it adjusts the camera (zooming out) to fit those characters. Thank you!
i guess setting the x and y coordinates to be the average of all the player positions, and as for the z coordinate...
-get the average of all of the player's locations, we will call this averageVector
-have a sum, called TotalMagnitude
-loop through each player...
local c = game.Players:GetChildren() local TotalVector = Vector3.new(0,0,0) local length = 0 for i, plr in pairs(c) do local char = plr.Character if char then TotalVector = TotalVector + char.PrimaryPart.Position length = length + 1 end end local AverageVector = TotalVector/length local TotalMagnitude length = 0 for i, plr in pairs(c) do local char = plr.Character if char then TotalMagnitude = TotalMagnitude + (char.PrimaryPart.Position - AverageVector).magnitude length = length + 1 end end local averageMagnitude = TotalMagnitude/length --Your X value for the camera is AverageVector.X --Your Y value is AverageVector.Y --Your Z value is averageMagnitude (if you want it to be a little further, then Z + 5 or something, same with X and Y)
What this is doing is taking each player's distance from all of the players' average location, and finding the average distance between them all. basically, the camera will move out the further the players get from eachother. as for the x and y, thats just the average of all the players' locations. I havent tested this, so you may need to make some tweaks once you add it.
EDIT: the code above does not move the camera, it is simply the math that gets the camera position. if you would like me to make a script that does this, i would be happy to do so