playMaker

Author Topic: Camera rotation at the edge of the screen  (Read 1539 times)

Bobyteal

  • Playmaker Newbie
  • *
  • Posts: 30
Camera rotation at the edge of the screen
« 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  !

plinm

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Camera rotation at the edge of the screen
« Reply #1 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.

Deek

  • Full Member
  • ***
  • Posts: 133
Re: Camera rotation at the edge of the screen
« Reply #2 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.

Bobyteal

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Camera rotation at the edge of the screen
« Reply #3 on: August 04, 2017, 02:54:25 AM »
Thanks Deek, that led me to the solution (screenpick action), appreciate your help  ;)
« Last Edit: August 04, 2017, 02:58:55 AM by Bobyteal »