Announcement

Collapse
No announcement yet.

How to make Enemy rotate around an object to stay between the player and the object?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to make Enemy rotate around an object to stay between the player and the object?

    I'm trying to get an enemy to stay between a player and specific object as the player moves around but I'm not sure about how to go about doing this, any help would be appreciated Thanks.

    #2
    Super easy, you can just create a vector from the player to the object and use that as your target location for your enemy (either lerp to it or set it instantly).

    Code:
    FVector playerToObject = player.GetActorLocation() - OurObjectToProject.GetActorLocation();
    playerToObject.Normalize();
    
    // then scale that vector by how far you want your enemy to be off and set your enemy's location (or lerp towards it).
    Able Ability System - A high performance, robust ability system for UE4. Now Available!

    Comment

    Working...
    X