Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: PolyMad on September 07, 2018, 01:34:38 PM

Title: Mouse Look issue[SOLVED]
Post by: PolyMad on September 07, 2018, 01:34:38 PM
Not really an action request, but a small addition to an existing one.
The Mouse Look action always start the asset with rotation coordinates reset to 0,0,0.
It would be nice if at scene load the action would get the rotation values of the game object.

Btw, what is the difference from Mouse Look and Mouse Look 2 ???
Title: Re: Mouse Look issue
Post by: djaydino on September 08, 2018, 02:29:38 AM
Hi.
You might be able to do this by using a parent and set the camera as child
Then use mouse look on parent and you can set the desired rotation on the camera.
Title: Re: Mouse Look issue
Post by: PolyMad on September 08, 2018, 02:30:54 PM
Heee hee tried already! The problem is that even if you set the parent etc. the VARIABLES inside the script are NOT updated with the actual variables of the object. In other words, no matter what object you use the script on, its rotation is ALWAYS reset to the script's variables at load map.
I even tried to parent the object and then destroy the parent, but of course this didn't work either.
The script simply doesn't care what is the actual rotation of the objects and IMPOSES its own variables values.
Title: Re: Mouse Look issue
Post by: djaydino on September 11, 2018, 01:01:59 AM
Hi.
Did you set the to the parent (not the camera)
then the 'offset' on the camera?
Title: Re: Mouse Look issue
Post by: PolyMad on September 11, 2018, 01:06:40 AM
Can't understand what you mean.
Title: Re: Mouse Look issue
Post by: djaydino on September 11, 2018, 01:19:04 PM
Hi.
Never mind, i just tested that but i get some strange behavior.

i made recently a mouse invert and added an offset to it.

in the attachment below i added a scene (with a setup) + the action
as you will need to convert 360 value to a -180/+180 it is best to check the scene.

i did not have a lot of testing, so pls let me know if it works :)
Title: Re: Mouse Look issue
Post by: PolyMad on September 11, 2018, 07:56:44 PM
Man I see what you did there! Quite cool  :D
It works, but I wonder: isn't it a bit intricate? Wouldn't it be simpler to just take the actual object coordinates and update the script rotation variables at start?

Btw, to INVERT the directions of MouseLook, just put negative coordinates in the sensitivity  ;D
Title: Re: Mouse Look issue
Post by: PolyMad on September 11, 2018, 08:50:34 PM
Tested the action: seems to be working perfectly. The only thing is the secondary object to orient annoyance, but for now it will be ok.
Thank you very much!  :-*
Title: Re: Mouse Look issue[SOLVED]
Post by: djaydino on September 12, 2018, 02:07:55 AM
Hi.
I will see if i can add this inside the action when i get home.
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on September 12, 2018, 09:02:48 AM
Another problem with the MouseLook action: it's not possible to use it as a child of any imported object that comes from a modeling software that uses Z as axis up, because the object gets naturally rotated by -90 degrees on the X axis and you end up rotating around the Z axis (horizontal) instead than the Y axis.
The MouseLook action seems to be using RELATIVE coordinates to the parent object instead than world coordinates.
Title: Re: Mouse Look issue[SOLVED]
Post by: djaydino on September 13, 2018, 01:13:00 AM
Hi.
Parent in an empty object and it should be fine, can't really change that...

from what i understand you are rotating objects? (not the camera)

if so, maybe you could tthis :
Have a 'dedicated' parent. (empty gameobject)
When you select an object to rotate, set the 'dedicated' parent to the position from the object.
Then parent the object to the 'dedicated' parent.

The 'dedicated' parent handles the rotation.
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on September 13, 2018, 05:49:37 AM
OK, tried in any possible way with parenting, it doesn't work.
When Unity imports a model with Z up, it flips it 90 degrees on X axis.
If you add a dummy to correct this, for some reason the MouseLook action still finds the first parent object and refer to that as "world" axis.
I attached the orbit system, have a look if you have time.
First use it as it is, in the world. It works.
Then make it a child of any imported object from a program that uses Z up, and you'll see.
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on September 13, 2018, 05:56:41 AM
Not that there's no solution to this: it's enough to add a FSM that at each frame positions the orbit dummy onto the main vehicle body exact coordinates et voilá.

But it would be a DIRTY solution and would also add quite some coding to my system: at the moment I scan the vehicle to find its POVs and then I cycle through them when the user presses a key, positioning the camera on them.
But if I detach the bird eye POV I will have to change this and I will have an additional object to manage.

I beg you if you find time to correct the MouseLook action so that it simply rotates on X and Y from its PARENT object (and an option can be added to simply use world coordinates) and that thing of getting the rotation from its own object when the script starts.
I think this would make the action clean and complete.

Even though... I also have a suggestion to make it even better: a SMOOTH STOP when the limits are reached would be a nice addition.
Title: Re: Mouse Look issue[SOLVED]
Post by: djaydino on September 14, 2018, 01:40:39 AM
Hi.
To have the camera separate from the player or object is actually the best solution.

i just recently build a fps control for a client which had the camera as a child from the object.

It gets the position from the player and it moves the camera holder to that position
also it gets the camera y rotation to set the players rotation.

One of the main reason i did this is :
When the camera was on the player and i would parent the player on a moving object (so it moves with the platform) the camera gets a 'juke' and when unparent also.
I stripped the scene and attached it here.

in your case, once entering the vehicle you could "pause" following the player(camera holder) , then tween the position to the vehicle and then follow the vehicle.

to add smooth stop would need a rebuild from the complete action. or make a custom system not using mouselook directly.
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on September 24, 2018, 03:22:44 PM
Duh I forgot to answer here... ok, I'll follow your suggestion then.
Maybe I have an idea to make it simple.

Btw, the difference between Mouselook and Mouselook 2 ?
Anyone?
Title: Re: Mouse Look issue[SOLVED]
Post by: craigz on April 21, 2020, 12:30:51 PM
Megmaltese! :D

I literally JUST discovered this issue now that you're explaining about the rotation. 100% true! Enters state and suddenly my character is looking up in a random direction lol

How did you end up fixing this?? (if you did)

Thank you for even trying to word this problem :P

-craigz
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on April 21, 2020, 05:36:04 PM
DJDino was so kind to modify the action and you can add an angle offset to it now.
Not the best thing, but it should work.

https://hutonggames.com/playmakerforum/index.php?topic=19382.msg84566#msg84566
Title: Re: Mouse Look issue[SOLVED]
Post by: craigz on April 22, 2020, 02:57:54 AM
Ahhh! I hadn't looked through him sample but I had imported the action. Okay so you still have to manually add the offset. Got it! I was originally thinking along your train of thought like 'why couldnt it just take the rotation of the game object initially??' 🤦‍♂️

Thank you! :D
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on April 22, 2020, 03:27:50 AM
I wasted also some time to re-align the object after game start, su... I'm with stupid  ;D ;D ;D
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on May 01, 2020, 10:35:00 AM
Houston we got a problem here.
Each time the state with the Mouselook is entered, the offset is added to the object.

The right way to do this action is to initialize it by getting the rotation vector of the parent object, and storing the variables in the script vector.

And then... nothing. Then that's it. From that moment on, the action is exactly the same old Mouselook we know and love.
It just need a small initialization phase where the parent object vector is stored in the action vector data.

Anyone so kind to do this, in these times of quarantine?  :D
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on May 01, 2020, 10:40:04 AM
Or wait, I solved it, with a little trick.
I have put an Init state where the Mouselook action is called only once, so that the offset is added.
Then the every frame action happens in another state, with 0 offset.
Title: Re: Mouse Look issue[SOLVED]
Post by: PolyMad on May 01, 2020, 04:04:52 PM
Back to black: it doesn't seem to work. My "solution" introduces other problems.