Unlock FirstPersonTransition event of Camera

http://wiki.roblox.com/index.php?title=API:Class/Camera/FirstPersonTransition

Why is this locked? It’d be much better to use than having to check in a loop the character’s camera-head magnitude or using the hacky “check if mouse is locked center and within center magnitude” method.

4 Likes

I don’t even know if this event works anymore, since the camera is running in pure Lua.
There’s nothing wrong with checking the magnitude between the focus and the cframe of the camera. Its pretty much what the camera code is doing.

I mean, if it does work then it may as well be unlocked. For me, it’s more like saving unnecessary and unreliable CFrame checks. It’s not that it’s “expensive”, more so that if you’re in third person you can walk against a wall and get your camera close to a wall and trick the script into thinking you’re in first person.

I’m guessing that this is RobloxPlaceSecurity because it was added for some official Roblox game back in the day and was forgotten or deemed not that useful.

You can reliably check first-person if the camera’s CFrame position is less than 0.5 studs from the camera’s Focus position. This is how the engine does it internally, so it’s guaranteed. Being more transparent about this would be great, I know!

It doesn’t work.

Noted, thank you.[quote=“Fractality_alt, post:5, topic:34705, full:true”]
It doesn’t work.
[/quote]

KILL IT FROM THE API!!!

845804dd21cadc2a6c5500a9c74ccb8f1448c8a1.jpg

Yeah it would make a lot of sense to deprecate it

1 Like

It’d be neat if the CameraScript/ControlScripts had APIs of their own that could be interacted with to provide this sort of animation. I know you guys are wanting to make them feasible to configure without replacing the whole script, losing out on future updates, and this kind of interface could help in that regard as well.

This is the best solution IMO. We would have to make a bunch of APIs to fire events like FirstPersonTransition from Lua-> C++ ->Lua to make APIs like this one available on the Camera object. To me it makes more sense if we just provide a good interface with the Camera PlayerScripts that provides the features that developers need without having to completely fork the scripts.

4 Likes

This is still an issue and sadly 3+ years has passed by already.

I need this to detect when the player goes into first person to disable certain things but I would need to create an alternative way which wastes my Development time.

2 Likes
local StateChange = Instance.new('BindableEvent')
local CurrentState = "Third"
local Player = game:GetService('Players').LocalPlayer
local Camera = workspace.CurrentCamera
StateChange.Event:Connect(function()
	if CurrentState == "Third" then
		print('Its third person')
	elseif CurrentState == 'First' then
		print('Its first person')
	end
end)

while wait() do
	if (Camera.CFrame.p - Camera.Focus.Position).magnitude <= 0.51 then
		if CurrentState == "Third" then
			CurrentState = "First"
			StateChange:Fire()
		end
		--print('first?')
	else
		if CurrentState == "First" then
			CurrentState = "Third"
			StateChange:Fire()
		end
		--print('third?')
	end
end

I don’t see the issue…?

That’s exactly the issue, I always avoid using a while loop when possible when it can be replaced with an event, but thanks for the code, I can appreciate it very much.

It’s easier to use the event and not waste my time creating something redundant is key here.

I mean, it is up to you as a developer to make your own methods. They can’t possibly create every singe little thing, when it can easily be made with what is already made.