I want to achieve a jumpscare camera like the one we see in Piggy.
I made a simple camera script that I thought would do the trick by just fixing the camera in first person while facing a certain character. The thing is, the camera is too close to the character that I want to focus on.
Whenever Piggy attacks you it is 1 or 2 studs away from your character. However, the jumpscare camera makes it seem like you are a little farther, without your own character in the way of its view. How would I approach making this?
If you are curious of what my current code looks like, look below.
If there were tutorials on how to do this on youtube, I wouldn’t have made this thread. I also wouldn’t have made this thread if I wanted someone to do it for me.
I am asking how I can improve my code to achieve the effect you would see in Piggy. Please, if you do not have a solution that would help me find new ways to tackle this problem, try not to pass “pay someone to do it for you/just find tutorials on youtube” as a solution. Thank you.
I edited my post to have the code that I made. But, I am looking for how other people approached this in their games, I’m not looking for someone to troubleshoot my code itself.
Just make your own character transparent and make the camera be a more comfortable distance away. You can also try tweaking Camera properties like FOV.
Don’t position the camera based on the player’s position. Position it based on Piggy’s position. Anchor Piggy’s HumanoidRootPart or something, then position the camera like this.
camera.CFrame = piggy.Head.CFrame:ToWorldSpace(CFrame.new(Vector3.new(0, 0, -5))) --play around with the Vector3, like make some numbers negative and whatnot until you get the result you want
--this is an example, you have to pass over piggy in the remote or find another way to access piggy
If you want to get cool, you can tween the CFrame of the camera.
Make sure you’re sending the right character. In this case, you want to send over piggy from the RmeoteEvent, or find another way to access piggy from the client.
The code for a jump-scare goes something like this. Client code anyway, you can handle the server sided stuff on your own.
local camera = workspace.CurrentCamera
Jumpscare.OnClientEvent:Connect(function()
camera.CameraType = Enum.CameraType.Scriptable
local oldCFrame = camera.CFrame
-- you can change other properties like field of view here before you change the CFrame
camera.CFrame = -- displacement CFrame goes here.
-- wait some time, or however you want to handle it.
camera.CFrame = oldCFrame
end)
This code is a guide, not an answer. This stuff is pretty simple and you should learn about camera manipulation.
i tried to make a jumpscare like piggy before but what happened is that the NPC jumpscared me but behind the the NPC was facing At the back of the player. What is the issue?