Hi, I know this is going to be a complicated answer, but I’m desperately trying to figure out how i can get a player to press E when entering a sphere or box Collison on a dog and a leash will attach to the dogs collar and the players hand and the dog will walk Infront of the player, so example if the player is running, the dog will run, if the player is walking the dog will walk but the dog always needs to be Infront of the player. I do have and dog and the animations. I’m a newbie so please bare that in mind when giving advice.
TIA
when giving advice
Break it into small, more manageable pieces first. Without knowing what you already have working, it’s pretty much impossible to provide a tangible answer.
Look into how interfaces work this will allow you to interact with world entities more easily; if it’s just one dog, cast instead. an Overlap Event will produce a canine reference. I am assuming you understand how input works → look into that if that’s not the case.
- `E → Sphere Overlap Actors → Loop → call interface function (or cast)
- have the interface return any dog data and attach what is needed to the player’s component socket
a leash
Hard to advise without knowing how you made the leash. Particle System? Spline Mesh Component? Cable Component? Skeletal Mesh? Something else?
a leash will attach to the dogs collar and the players hand
Look into how mesh sockets work, this will allow you to attach component / actors. If the system is very simple, you can manually hardcode attachment offsets instead.
the dog will walk Infront of the player
Actors have a forward vector
- the direction they’re facing. You can project that vector by multiplying it by X Unreal Units and adding the actor’s world location. This will produce a world a location that is always X uus ahead of the player. A dog Pawn AI can navigate the navmesh
and attempt to walk to that destination.
A dog Pawn AI can navigate the
navmesh
so example if the player is running, the dog will run
Providing the above is set up, this part will be mostly automatic as the running player will produce the appropriate world location for the AI dog to follow.