playMaker

Author Topic: How to limit the mouse using the action "Follow Mouse"  (Read 33 times)

colpolstudios

  • Full Member
  • ***
  • Posts: 169
    • View Profile
How to limit the mouse using the action "Follow Mouse"
« on: July 11, 2019, 04:14:48 PM »
I wish to be able to limit my characters shooting ability, currently, I am using the action follow mouse, based on the position of the main camera.

In order to better improve the current system "https://hutonggames.com/playmakerforum/index.php?topic=20555.msg90096#msg90096" I require some advice and help to implement a better system.

Here is a web link to a playable demo but its an old one: https://simmer.io/@colpolstudios/mechanim-simple-ik

I have yet to update the web player build.

The model looks at a target, this target is using the follow mouse.

I wish to limit the target range both up and down so that the model only moves whilst aiming to a more accurate range.

I have been able to update the entire system, but this aspect requires your valuable help.

Also. I do not remember, how to insert a image on this page, sorry but help needed here as well.

Kind regards

colpolstudios


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4288
    • View Profile
    • jinxtergames
Re: How to limit the mouse using the action "Follow Mouse"
« Reply #1 on: July 14, 2019, 06:42:34 AM »
Hi.
i am not entirely sure what you mean.
But after testing the game i think i know what you mean (bare with me if i am wrong)

Follow Mouse will not work with this, you will need to make your own system.

i think you need to do something like this :

(State 1) when right mouse is clicked (State 2) get the mouse x and y.
Also get the current rotation from aim.

Quote
I noticed that 'Get Mouse X and get mouse Y can only be used every frame, i have requested alex to change if possible.
For now you can use Get Mouse Position (Ecosystem) and if you need them separately you can use 'Get Vector 2 XY'
Set in some variables (started X / Started Y)

(state 3)
Get mouse x/y every frame (place in variable current X / current Y)
and use float operator and do 'current - started' (every frame) for x and y and store in variable (X calculated / Y calculated)
You can now do a 'float multiply' to the 'calculated' to adjust the rotation distance
(play around with this to know which value fits best)
after the float multiply use Float operator and do 'aim (x/y/z) + calculated.
and then Set rotation.

I did not test this, but i think this should work.

The float multiply you can manipulate by another fsm so you could make it rotate faster/slower on demand.