Set Rotation to Enemy

Hi,

I’m working on a game project and what I’m trying to do is make a system where a sentry rotates left or right following my player. I’ve tried using the Find Look At Rotation node, the thing is I’m looking for a speed limit to this rotation and the Find Look At Rotation node seems to be instant. I’m a newbie on programming so every help is more than welcome to me.

For now the logic that i want to achieve with this system is pretty much this:

  • Whenever the player is within collision my actor will look for the player position on the X axis and if it’s positive it will rotate right, if it’s negative it will rotate left.
  • Whenever the player is within collision my actor will look for the player position on the Y axis, if it’s higher than a 70º angle upwards it will stop following vertically until it comes back down (pretty much putting a cap on how far up it can look for the player.

The problem is I don’t know how to work out this location to rotation relativity, My initial thoughts were to get the player character relative x location and subtract it from my sentry relative x location, but it didn’t work since the relative location for the player character is NOT relative to my sentry location… at least that’s what I think. Please help guys! :frowning:

Thanks! :3

Use RInterpToConstant with the FindLookAtRotation and plugin the result to SetRotation

Thanks!

I’ve made this litte system here with your suggestion and it worked perfectly how i wanted it. Now i’m just trying to figure out a way to set a cap on the Pitch rotation so that if my player character is too high it can’t follow.