playMaker

Author Topic: Mouse Look issue[SOLVED]  (Read 240 times)

megmaltese

  • Full Member
  • ***
  • Posts: 236
    • View Profile
Mouse Look issue[SOLVED]
« on: September 07, 2018, 10:34:38 AM »
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 ???
« Last Edit: September 11, 2018, 10:16:10 PM by jeanfabre »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3383
    • View Profile
    • jinxtergames
Re: Mouse Look issue
« Reply #1 on: September 07, 2018, 11:29:38 PM »
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.

megmaltese

  • Full Member
  • ***
  • Posts: 236
    • View Profile
Re: Mouse Look issue
« Reply #2 on: September 08, 2018, 11:30:54 AM »
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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3383
    • View Profile
    • jinxtergames
Re: Mouse Look issue
« Reply #3 on: September 10, 2018, 10:01:59 PM »
Hi.
Did you set the to the parent (not the camera)
then the 'offset' on the camera?

megmaltese

  • Full Member
  • ***
  • Posts: 236
    • View Profile
Re: Mouse Look issue
« Reply #4 on: September 10, 2018, 10:06:40 PM »
Can't understand what you mean.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3383
    • View Profile
    • jinxtergames
Re: Mouse Look issue
« Reply #5 on: September 11, 2018, 10:19:04 AM »
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 :)

megmaltese

  • Full Member
  • ***
  • Posts: 236
    • View Profile
Re: Mouse Look issue
« Reply #6 on: September 11, 2018, 04: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
« Last Edit: September 11, 2018, 04:59:17 PM by megmaltese »

megmaltese

  • Full Member
  • ***
  • Posts: 236
    • View Profile
Re: Mouse Look issue
« Reply #7 on: September 11, 2018, 05: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!  :-*
« Last Edit: September 11, 2018, 06:04:19 PM by megmaltese »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3383
    • View Profile
    • jinxtergames
Re: Mouse Look issue[SOLVED]
« Reply #8 on: September 11, 2018, 11:07:55 PM »
Hi.
I will see if i can add this inside the action when i get home.

megmaltese

  • Full Member
  • ***
  • Posts: 236
    • View Profile
Re: Mouse Look issue[SOLVED]
« Reply #9 on: September 12, 2018, 06: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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3383
    • View Profile
    • jinxtergames
Re: Mouse Look issue[SOLVED]
« Reply #10 on: September 12, 2018, 10:13:00 PM »
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.

megmaltese

  • Full Member
  • ***
  • Posts: 236
    • View Profile
Re: Mouse Look issue[SOLVED]
« Reply #11 on: September 13, 2018, 02: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.

megmaltese

  • Full Member
  • ***
  • Posts: 236
    • View Profile
Re: Mouse Look issue[SOLVED]
« Reply #12 on: September 13, 2018, 02: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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3383
    • View Profile
    • jinxtergames
Re: Mouse Look issue[SOLVED]
« Reply #13 on: September 13, 2018, 10:40:39 PM »
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.