Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: ivam on September 26, 2014, 05:23:59 AM

Title: [SOLVED]limit horizontal rotation on smooth look at
Post by: ivam 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.
Title: Re: limit horizontal rotation on smooth look at
Post by: ivam on September 26, 2014, 06:24:36 PM
shameful bump
Title: Re: limit horizontal rotation on smooth look at
Post by: mdotstrange on September 26, 2014, 07:02:31 PM
Would using a clamp action on the rotation help?
Title: Re: limit horizontal rotation on smooth look at
Post by: TrentSterling 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.
Title: Re: limit horizontal rotation on smooth look at
Post by: ivam 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 ?
Title: Re: limit horizontal rotation on smooth look at
Post by: ivam 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
Title: Re: limit horizontal rotation on smooth look at
Post by: ivam 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.