playMaker

Author Topic: [SOLVED] Simple rotation, irritating problem  (Read 1886 times)

FritsLyn

  • Full Member
  • ***
  • Posts: 191
[SOLVED] Simple rotation, irritating problem
« on: June 30, 2014, 08:13:58 AM »
Imagine a gun tower on the top of a plane. The plane flies and spins and loops around, not controlled by the player, who sites inside the gun tower on top of the plane.

Camera looking from inside gun tower and out.

Canons shooting at where gun tower points.

Simple, right?

Targets are found by look at.. and now the problem arises: When ever using any 'Look at' function to focus on a target, both X, Y and Z are spun.

And the gun tower only should be able to spin in local Y and X axis (up/down / left/right - not twisting around Z)

Nesting parents, Vector3 XYZ grabbing and I don't know what - this appears to be such a simple task but for some reason I'm just freaking stuck for days on it!!

Any clever and helpful friends out there? :)

My gun tower is spinning on one too many axes!

Thanks a bunch!!
« Last Edit: June 30, 2014, 10:45:54 AM by FritsLyn »

redikann

  • Full Member
  • ***
  • Posts: 174

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Re: Simple rotation, irritating problem
« Reply #2 on: June 30, 2014, 10:45:39 AM »
Imagine that: Brute forcing one angle .. but it works :)
Thanks a bunch for the link redikann!
I had not seen it.