playMaker

Author Topic: Self made Mouse Look  (Read 2313 times)

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Self made Mouse Look
« on: September 07, 2018, 08:56:04 PM »
I'm trying to make a "physical" Mouse Look FSM but I have a problem with the mouse.
There's no action to set the Mouse Pointer coordinates, so when it hits the screen limits I'm ruined.

First question: why there's no action to set the Mouse Pointer coordinates?

Second question: in the MouseLook 2 action there's a Lock Cursor option, that freezes the mouse pointer at the center of the screen.
That would be ok for me, but when I put this action in the State, the mouse doesn't move at all.

Third question: I see that the Get Mouse X and Y return the position on the screen.
Of course I need to calculate the DIFFERENCE from the previous frame position, but there's a problem: if I put both the "previous" and "later" Get Mouse, they will happen in the same frame (I guess) and I won't have any difference.
So I should place a first and an after in 2 states, that would make the thing extremely inefficient.

I really need this thing.

How can I solve all this?
CAN it be solved?

I think it's impossible at the moment in Playmaker to simulate an analogic joystick by using the mouse.
I think we are missing these actions:
Mouse Lock to lock the mouse pointer at the middle of the screen-
Get Mouse Difference X and Get Mouse Difference Y: give back the mouse position difference from the previous frame.
And of course also Set Mouse X and Set Mouse Y could come useful to somebody.

« Last Edit: September 07, 2018, 10:28:15 PM by megmaltese »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Self made Mouse Look
« Reply #1 on: September 17, 2018, 01:47:15 AM »
Hi.
Catching up un-replied post.

Quote
First question: why there's no action to set the Mouse Pointer coordinates?
You will need an api for that as the movement is done by windows(or mac) not the game itself.
There are some assets on the assets store that can handle that.
Quote
Second question: in the MouseLook 2 action there's a Lock Cursor option
Are you on a older Playmaker version, i don't have this on Mouse Look 2.
But there is an action called "Set Mouse Cursor' to lock the mouse.

You would need a next frame event as you might not have any movement yet in the same frame and get bad results.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Self made Mouse Look
« Reply #2 on: September 17, 2018, 05:56:55 AM »
Doh my Playmaker is 1.9, quite updated.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Self made Mouse Look
« Reply #3 on: September 17, 2018, 07:03:13 AM »
Hi.
Strange on mine i cant see the lock cursor option.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Self made Mouse Look
« Reply #4 on: September 17, 2018, 01:34:43 PM »
Wait. The Mouse Lock option IS on Set Mouse Cursor!  ;D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Self made Mouse Look
« Reply #5 on: September 18, 2018, 01:31:36 AM »
Hi.
Aw lol.

If you lock it, indeed the mouse cursor will not move indeed, but the mouse look should still rotate the object.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Self made Mouse Look
« Reply #6 on: September 24, 2018, 04:28:18 PM »
You will need an api for that as the movement is done by windows(or mac) not the game itself.

But so how does the Lock Cursor option work? Isn't it continuously setting the mouse pointer to the middle of the screen?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Self made Mouse Look
« Reply #7 on: September 25, 2018, 02:49:40 AM »
Hi,
on the unity docs it only states that it is locked in the center of the screen :
https://docs.unity3d.com/ScriptReference/Cursor-lockState.html

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Self made Mouse Look
« Reply #8 on: September 25, 2018, 03:18:02 AM »
Oh it's Unity setting it, I thought it was Playmaker doing it.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Self made Mouse Look
« Reply #9 on: September 25, 2018, 03:28:23 AM »
Hi.
Most stuff in the actions is done by unity :)