spending 2 hours to split LookAt rotation between two nested transforms where parent was supposed to only recieve the vertical axis rotation and the child the horizontal axis rotation. (unity3d)

still haven't solved it btw, because my nerves and the deadline of the project i needed it for both ran out and i'm still sick to my stomach at the thought of going back to it to solve it because of how trivial it should be and how insanely was i battling with it.

  • 0
    (to my very poor defense, it was after 2 days and nights of gamejam-style marathon coding)
  • 0
    Huh? If you have xy coordinates from look at, apply y to the parents y, add -y to the child's y (if it should stay how it was), apply x to child.

    How you apply the negative y to the child depends on how it's positioned relatively to the parent

    lookAt = { 5, 10 }
    parent.Y = lookAt.Y
    child.Y = -lookAt.Y
    child.X = lookAt.X

    Don't know if it makes sense at all, I made this up in my mind. Maybe it helps 🙆🏻‍♀️
  • 0
    @Kimmax it makes theoretical sense (except LookAt is a function on the transform, taking the target point as param, so you have to do the splitting (zeroing of vector components) on the position before supplying it to the func), and i tried that, but there's still some fiddly details in implementation, and i couldn't get it to behave correctly.

    yes, as i said, should be trivial in theory, was not (at least for me at that time) in implementation. why do you think i posted it as wk88 topic? ;)
  • 0
    @Kimmax negative y shouldn't be applied to the child because i apply relative/local rotation therefor child partially rotates with parent and that's fine... or i do have to apply it, not sure, none of the variants worked but maybe i had error somewhere upstream and dude, what is this? stackoverflow? i was ranting, not asking for advice!!! =D

    thanks for the effort, though
Your Job Suck?
Get a Better Job
Add Comment