Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Bobyteal on August 03, 2017, 09:59:43 AM

Title: Camera rotation at the edge of the screen
Post by: Bobyteal on August 03, 2017, 09:59:43 AM
Hi  :)

I want to rotate the camera on the left/right when the mouse reach the edge of the screen. So I know how to do it with mousePosition, but my little problem is that this only works on a very precise resolution, I would like to do a system that works for all resolutions !

Any idea ? Thank you  !
Title: Re: Camera rotation at the edge of the screen
Post by: plinm on August 03, 2017, 11:52:06 AM
https://docs.unity3d.com/ScriptReference/Input-mousePosition.html

I am not sure if I understand you correctly, but you can always get current screen width by
Code: [Select]
Screen.width, and compare it with
Code: [Select]
Input.mousePosition.
Title: Re: Camera rotation at the edge of the screen
Post by: Deek on August 03, 2017, 12:22:08 PM
You have to convert your mouse position to the in-game world point with the action "Screen To World Point" to get a resolution-indepependent point in space.

If that wasn't what you were looking for, there's an action on the Ecosystem called "Get Mouse Position Advanced" with the option to get the input from screen center.
Title: Re: Camera rotation at the edge of the screen
Post by: Bobyteal on August 04, 2017, 02:54:25 AM
Thanks Deek, that led me to the solution (screenpick action), appreciate your help  ;)