Doing some simple yet specific math on the Camera’s FieldOfView will cause your Character to die.
deathwhilechangingvalues.rbxm (2.1 KB)
Doing some simple yet specific math on the Camera’s FieldOfView will cause your Character to die.
deathwhilechangingvalues.rbxm (2.1 KB)
while using your script my character fell over sometimes so im guessing it somehow causes your character to be teleported into the void but even then how is that possible. what is your script supposed to do ![]()
I remember this being pointed out by somebody. I don’t know why this wuld happen but it is defenatly to do with the core scripts.
The problem is that the ControlModule calculates the character’s MoveVector based on the camera. You just so happen to be hitting the right values to cause it to go nan (and calling Player:Move with a nan vector kills the player).
The problem is specifically with this line of code inside the ControlModule:calculateRawMoveVector method:
local norm = math.sqrt(c*c + s*s)
return Vector3.new(
(c*cameraRelativeMoveVector.X + s*cameraRelativeMoveVector.Z)/norm,
0,
(c*cameraRelativeMoveVector.Z - s*cameraRelativeMoveVector.X)/norm
)
Can you spot the issue? If norm is zero (which can happen if both the R00 and R01 are unset), the X and Z axes get divided by zero.
Hi, thank you for reaching out about this issue. It seems like this is not caused by our code, and hopefully fixing your logic will make your issues go away.
What do you mean ‘not caused by our code’? The bug is specifically caused by the ControlModule not handling these edge-cases correctly. Even if having an unaligned CFrame is ‘not by design’, it shouldn’t be killing the player.
Please reconsider. At the very least, change the behavior of calling Player/Humanoid:Move to ignore nans (or better yet, cause a warning so cases like these can get fixed).
Hi,
Thank you for your feedback, I can reopen this ticket and raise this issue.
“NaN” is not an edge case, it’s your game code creating an undefined state.