playMaker

Author Topic: [SOLVED]limit horizontal rotation on smooth look at  (Read 4016 times)

ivam

  • Playmaker Newbie
  • *
  • Posts: 34
[SOLVED]limit horizontal rotation on smooth look at
« on: September 26, 2014, 05:23:59 AM »
heya guys,

ive got the head of my character looking at an object created on collision with raycast from the camera, so the head allways looks where the camera looks at, however naturaly i need to limit the heads rotation to -60 and +60 degrees but iam getting frustrated as i cant find a solution after 3 hours.

id simply like the characters head to go back to 0 Y rotation as soon as it would passes a certain point of rotation so i dont get the 360 spinning head effect.
« Last Edit: September 28, 2014, 01:28:46 PM by ivam »

ivam

  • Playmaker Newbie
  • *
  • Posts: 34
Re: limit horizontal rotation on smooth look at
« Reply #1 on: September 26, 2014, 06:24:36 PM »
shameful bump

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: limit horizontal rotation on smooth look at
« Reply #2 on: September 26, 2014, 07:02:31 PM »
Would using a clamp action on the rotation help?
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • My Blog
Re: limit horizontal rotation on smooth look at
« Reply #3 on: September 26, 2014, 08:24:15 PM »
Go bump this thread.

http://hutonggames.com/playmakerforum/index.php?topic=8032.msg40387#msg40387

It's for a new lookAt action with limits on each axis. Bumping the thread gives it attention.

ivam

  • Playmaker Newbie
  • *
  • Posts: 34
Re: limit horizontal rotation on smooth look at
« Reply #4 on: September 27, 2014, 03:49:19 AM »
Would using a clamp action on the rotation help?

probably but iam not sure how to approach this, the only clamp in playmaker is the float clamp i think and iam not sure how to clamp the rotation with a float clamp, especialy since its not as easy as from -60 to +60 degrees, since there aint any negative values for rotation, id have to clamp somehow from 300 to 360 and then from 0 to 60 ?

ivam

  • Playmaker Newbie
  • *
  • Posts: 34
Re: limit horizontal rotation on smooth look at
« Reply #5 on: September 28, 2014, 12:19:41 PM »
has no one else encountered this issue before ?

i feel like the only solution is to use a custom script rather than playmaker at this stage

ivam

  • Playmaker Newbie
  • *
  • Posts: 34
Re: limit horizontal rotation on smooth look at
« Reply #6 on: September 28, 2014, 01:28:03 PM »
solved it by comparing the angle of where iam looking at to the rotation of the body, becomes this angle greater than 80 degrees i flick a switch to make the character look forward.

only downside of it is that it makes the head snap back to its original position making it look jerky and unnatural, guess ill find a solution for that sometime soon too.