playMaker

Author Topic: Smooth Look At Direction - strange behaviour with rotation of a model[SOLVED]  (Read 3815 times)

marvoc

  • Playmaker Newbie
  • *
  • Posts: 37
Hello :),
 I’ve started play with Playmaker one moth ago and now I reach point where Im not sure if is it an error or my mistake.
I made this showcase video:
https://drive.google.com/open?id=1OYd2BhGPmJ3f7mESwFGlo8NWsySW6sDk
Imagine that red box is a tank (shape when is scaled).

So my issue that box when is using Smooth Look At Direction is starting rotating, but for me, without reason. Im using nav mesh and mouse pick for move.
I tried move with keyboard and is still the same.
I want raycast below tank, so Y = -1, and its working if I check debug line.

Im adding picture of settings too.
And I checked sample "Raycast Hit Normal" too.. but there is everything fine :)


Any ideas? :)

And, btw, this is an amazing plugin for Unity :) thanks for it!
« Last Edit: January 30, 2019, 12:03:33 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Smooth Look At Direction - strange behaviour with rotation of a model
« Reply #1 on: January 03, 2019, 02:30:34 AM »
Hi.
Have to tried playing around with the up vector and keep vertical?

Maybe look toward actions can help or mouse look

marvoc

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Smooth Look At Direction - strange behaviour with rotation of a model
« Reply #2 on: January 03, 2019, 02:42:50 AM »
Hi.
Have to tried playing around with the up vector and keep vertical?

Maybe look toward actions can help or mouse look

I was trying keep vertical, but then there is no effect of leaning on the hill.
The same was if I put 0,1,0 to Up Vector (I tried even different numbers on different axis).
But what is weird, that is it working, but only first time is rotating badly..
If I use another action, for me isn't the best, because Im then bending some functionality what is somehow working. Except of first rotation ;) And everything on a cube is with rotation 0,0,0.

Btw, I'm not sure what do you mean "look toward actions can help or mouse look" I can't find them :/
« Last Edit: January 03, 2019, 03:06:40 AM by marvoc »

marvoc

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Smooth Look At Direction - strange behaviour with rotation of a model
« Reply #3 on: January 04, 2019, 08:37:09 AM »
Hi again,
 so I tried this approach:
http://hutonggames.com/playmakerforum/index.php?topic=10246.0

and it works, but move was shaking, so still nothing to use. Seems that interpolation wasn't smooth.
I believe still that Smoot Look At Direction could get best result, but have no idea, how to make it..
Someone who knows? :)

Martin

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth Look At Direction - strange behaviour with rotation of a model
« Reply #4 on: January 28, 2019, 03:56:08 AM »
Hi,

 did you get to the bottom of the smoothing issue?

Bye,

 Jean

marvoc

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Smooth Look At Direction - strange behaviour with rotation of a model
« Reply #5 on: January 28, 2019, 04:58:04 PM »
Hi,
 thanks for your response ;)
So I made it in some way ;) I mean, that Smoot Look At Direction is working, because I created Raycasts, which one is saving Hit position and Normal, from a tank and second is on empty object in front (offset more up, if its going up to the hill) of a vehicle.
Then I made a vector between them (Vector3 operator with Subtract) and use it as Target direction for Smoot Look At Direction. And Up Vector Im using Normal from ground.

But now I have again some weird behaviour, which is:
Tank, after starting of a level, is rotating around Y axis in 180 degree. So I have back of a tank in its front.

Here you can see it on short video:
https://drive.google.com/open?id=1SEk4FVfXUFx16tGho5QwfGPRHbfOeg0q

Any ideas? :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth Look At Direction - strange behaviour with rotation of a model
« Reply #6 on: January 29, 2019, 02:59:36 AM »
Hi,

look at only work along the z axis. So you need to wrap your tank mesh into a gameobject which has the proper axis for the look at, that's all, so create an empty gameobject, add the tank as a child, and make the look at work on the empty gameobject, which means you can then orient the mesh any way you like.

Bye,

 Jean

marvoc

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Smooth Look At Direction - strange behaviour with rotation of a model
« Reply #7 on: January 29, 2019, 02:55:01 PM »
Hi Jean,
 thanks a lot its WORKING :)) nice and thanks for your help ;)
So we can (I dont know how) mark this thread as solved.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Smooth Look At Direction - strange behaviour with rotation of a model
« Reply #8 on: January 30, 2019, 12:03:17 AM »
Hi.
To set as solved, you can edit your 1st post and add [SOLVED] to the subject.
I have set this one for you :)