Hello everybody! I was wondering if anyone had anything that I could use to help replicate the camera system shown in this ION Formula Racing League Race
Any solutions would be appreciated, Thank you
Hello everybody! I was wondering if anyone had anything that I could use to help replicate the camera system shown in this ION Formula Racing League Race
Any solutions would be appreciated, Thank you
Maybe you could make an anchored part, which looks always to the selected person and then change the camera cframe to the part cframe
so the part look at the player, and the camera is always in the same position the part is
But I’m not totally sure if this works, I already made it for a security system, but I never make the part look at the player, I just made moving to the sides with the time
In the video, it seems that the best camera is automatically determined when the spectator presses the button to view a specific individual. You could likely replicate this by first checking what player’s button was pressed and storing their position in a variable. Then, you loop through all of the available cameras on the map and check to see which is closest to the player. Once you find the closest one, you have a RenderStepped function that sets the camera’s CFrame accordingly.
To set up the list of players on the side, you could have a ScreenGui with a Frame inside. In the Frame, you would have a UIListLayout object. Anytime the PlayerAdded function is fired, you would add a TextButton with the text and name being the name of the player that was added. Anytime the PlayerRemoving function is fired, you would find the child of the Frame that’s name is the same as the player that has left and delete it.
To loop through all of the available cameras, you would probably want a model or a folder containing all possible positions for cameras across the track. You would then use a for loop and iterate through each camera’s position (or its primary part’s position), then use a distance formula like (x2-x1).Magnitude to check the distance of the specific camera that the for loop is currently iterating over. If the distance is smaller than the distance of the camera that was previously iterated over, you change that to be the smallest distance so far, if not, move on. By the end of the for loop, the smallest distance will be determined meaning that you have found the closest camera to the player (Find the smallest element in an array this link explains it quite well even though its in a different language).
Once you have the closest camera, you would use a RenderStepped function to constantly set the CFrame of the players local camera (workspace.CurrentCamera) by using CFrame.new(position, lookAt). In this case, your ‘position’ is the position of the camera you found to be the closest to the player, and your ‘lookAt’ is the position of the player’s character.
(dont forget to change camera to Scriptable)