Hello!
Recently I’ve tried to play my RDC 2018 gamejam game and ran into weird issue. I couldn’t get my character to spawn. I’ve tried creating SpawnLocation, but that didn’t fix the issue either. After some debugging I’ve figured out it’s an issue with setting Camera CFrame.
The issue is related to CFrame.new ( Vector3 pos, Vector3 lookAt ) constructor.
Setting camera’s CFrame to
CFrame.new(Vector3.new(), Vector3.new(0, -1, 0))
will work correctly, but if we change -1 to -110 or -109 (haven’t found any other numbers causing that issue, -111 and -108 work fine), it will start killing character on change.
Full script:
local Camera = game:GetService("Workspace").CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
local RunService = game:GetService("RunService")
while RunService.RenderStepped:wait() do
-- Those work correctly:
-- Camera.CFrame = CFrame.new(Vector3.new(), Vector3.new(0, -1, 0))
-- Camera.CFrame = CFrame.new(Vector3.new(), Vector3.new(0, -111, 0))
-- This does not work correctly:
-- Camera.CFrame = CFrame.new(Vector3.new(), Vector3.new(0, -109, 0))
Camera.CFrame = CFrame.new(Vector3.new(), Vector3.new(0, -110, 0))
end
(Place in StarterPlayerScripts, the magnitude matters, if we move both start and end position, the issue will still be happening)
I honestly have no idea why it could happen especially since CFrame.new(Vector3.new(), Vector3.new(0, -110, 0)) should be the same as CFrame.new(Vector3.new(), Vector3.new(0, -1, 0)) . This seems to be a really complex issue - pretty easy to fix, but might have more serious root cause.
https://gyazo.com/6f73d268f23d8ef329239fb9996efc88 (Working fine - not killing)
https://gyazo.com/d388fbf9ee8e751922450d5872ed6dda (Working incorrecetly - killing)
For sure the bug started happening after RDC 2018.