playMaker

Author Topic: Can objects use lookat locked to one axis? (like a turret)  (Read 2370 times)

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Can objects use lookat locked to one axis? (like a turret)
« on: September 07, 2016, 03:25:46 PM »
I have a scene where I need a turret to track/turn to face the player, however the turret needs to stay locked in a level position regardless of the height off the ground of the player.  Is this possible with playmaker?

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Can objects use lookat locked to one axis? (like a turret)
« Reply #1 on: September 07, 2016, 03:53:55 PM »
Ok, so I have found the "keep vertical" function of the look At function.... but the problem is I also need turrets on the side of vehicles.  Is there any way to change which way is "vertical"?  I see something called "up vector" is that something to do with it?

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Can objects use lookat locked to one axis? (like a turret)
« Reply #2 on: September 07, 2016, 05:00:25 PM »
I just made an action yesterday for my own project that might work for you- its on Ecosystem called "Robot Arm Look At"


It only allows rotation on an objects X axis and you can set limits as to how far it can rotate before stopping- should work for your side turrets if you have a target object for them to look at-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Can objects use lookat locked to one axis? (like a turret)
« Reply #3 on: September 07, 2016, 05:03:41 PM »
That looks promising, I'll check it out, thanks!  Can the rotation be locked to the local X axis?  Or only the global?  I really need to keep the rotation locked locally as the vehicle moves about.

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Can objects use lookat locked to one axis? (like a turret)
« Reply #4 on: September 07, 2016, 05:08:40 PM »
OK... I tried your script and it doesn't seem to lock any axis at all, with or without the box checked.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Can objects use lookat locked to one axis? (like a turret)
« Reply #5 on: September 07, 2016, 05:40:36 PM »
I just tried the exact script I linked too

Settings
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Can objects use lookat locked to one axis? (like a turret)
« Reply #6 on: September 07, 2016, 05:46:59 PM »
ahh, sorry I accidentally made it the child of the object I was tracking!  I'll play around some more