playMaker

Author Topic: look at - limit rotation range  (Read 4879 times)

kurageart

  • Playmaker Newbie
  • *
  • Posts: 13
look at - limit rotation range
« on: January 14, 2013, 10:45:40 AM »
Hi.. I was wondering if is possible to somehow limit the rotation angle of the action: look at (or smooth look at).
I want to assign look at at my character head, following clicked objects on the scene, and possibly avoiding an "The exorcist" effect letting the head completing 360 degree rotation...
Hope you can help, I guess this is a very noob question :)

Alio

  • Playmaker Newbie
  • *
  • Posts: 19
Re: look at - limit rotation range
« Reply #1 on: January 14, 2013, 04:07:25 PM »
Maybe set variable for angle of rotation for your character cam look vs your character local rotation and if its greater than x either rotate char towards or return null so it stays in that general direction you could probably set it to return back to 0 so it lines up with your character as well. I'm thinking that you may have to put a raycast in there to compare with a radar type set up of the angle from 0 of your character local rotation vs the look/smooth look at angle. I know that if you want to set up a compare though you first have to create and define those variables though you might want to use a float instead of an int for the degrees. hope that helps
I just frankenstein it.

kurageart

  • Playmaker Newbie
  • *
  • Posts: 13
Re: look at - limit rotation range
« Reply #2 on: January 16, 2013, 07:20:37 AM »
MM complex, but I think I'm getting the concept... I will try to explore a solution, and eventually ask again ! Thank you!

buggie

  • Playmaker Newbie
  • *
  • Posts: 7
Re: look at - limit rotation range
« Reply #3 on: July 22, 2015, 01:07:27 AM »
Hey, i am working with a similar problem. I came across an easy solution for you to use that almost works for me.
I created 3 parent cubes, used smooth look at for each one, one for center, left, and right. this will make it have a max turn degree.
Great for use with an analog control stick for look left and right.
I was looking for a fix to keep the object that was rotating to look at the other cubes from rotating on any axes except Y. I cant use a ridged body as it interferes with other scripts im using. I tried to always update the rotation of X, and Z, to set to 0, but got an error for that. Still looking for a solution, but this will work well for you if you make the head that rotates a child of a cube that is set to look at other cubes that are parented to it. Remember the rotating cube sits as a child of the target look at cubes, and they are the child of the object that controls the characters movement.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: look at - limit rotation range
« Reply #4 on: July 22, 2015, 10:57:14 AM »
Hi,
maybe try a float clamp?