jeffaroundtheworld / 2024gamecollab

0 stars 1 forks source link

Vertical limitations for player mouselook #24

Closed jeffaroundtheworld closed 7 months ago

jeffaroundtheworld commented 7 months ago

Current mechanic allows player to loop 360 when looking up and down.

Find a way to limit vertical "looking".... investigate the use of the clamp() function?

Dylanimal commented 7 months ago

Here is one way to do it which is in the code I'm working on for the player.

$CameraPivot.rotation.x -= event.relative.y / sensitivity $CameraPivot.rotation.x = clamp($CameraPivot.rotation.x, deg_to_rad(upLook_limit), deg_to_rad(downLook_limit))