im making a game and im planning this mechanic where the players camera “locks on” to another player. its togglable and the idea is the camera stays with the original player, and focuses on the object it locks onto.
With that being said, im not exactly sure where to start. How would i achieve this?
help is appriechiated, thank you for your time
Hey, a lot of people have asked this question before. A simple google search will pull up:
Hello guys, I want to show you how to make a lock-on camera in roblox its fairly simple. It will utilize this formula i made.
V = B + ((A + Offset) - B).Unit * ((A - B).Magnitude + Extra)
(A - B).Unit gives you a direction vector of B pointing to A
(A - B).Magnitude gives the distance between A and B
Ill try to break these down into what they mean in the line ^^^
B = The object you want to look at but its the origin as well
A = is the object that B is shooting out towards
I suggest reading through those articles, looking at their code, and modifying it to your liking. It should provide a good place to start.
The second one goes through unnecessary steps, literally all you need is:
workspace.CurrentCamera.CFrame = CFrame.new(Player1.HumanoidRootPart.Position,Player2.HumanoidRootPart.Position)
Of course you’re gonna have to edit it a little bit to make it more tolerable, but that’s way easier than the second Tutorial.
There is actually a great resource created and provided by
@epictitanic6g, although it may be more advanced.
You can take a look at the source code of the resource to learn how it works!
The link to the un-copylocked resource should be found in the following forum:
Over the years i’ve seen numerous kinds of Roblox games evolve, from the paintball games of the early 2010’s to phantom forces, from speed run 4 to a full on remake of the first Super Mario Bros, and from small maps to full open worlds and RPGs, these have all evolved.
There is one genre that I still feel really hasn’t reached the potential it has though, and that is Melee Combat
Melee combat has seen some improvements over time, but nothing compared to other gam…
That’s besides the point I was making
There are resources available on the internet to help, it is best to check them before making a post.