Download

Physics constraints or spring arms?: Enemy formations in a motorcycle game.

Hey there,
I’m working on a motorbike game in which there is combat between the riders. Currently the enemy riders move to Child actors attached to my Player character. This attachment is done either directly through “attach to” nodes in blueprint, or via spring arm components which are the parents of the child actors.

My problem at the moment is that enemies shadow the movement of the player too closely. As the player moves, so do the Child actors, and so the enemies (who are able to move faster than the player) are always right beside the player.

My first attempt at resolving this was to use spring arms, as they could detect collision and move out of the way so that the enemies always had a valid MoveTo location (you can the child actors attached in this way in the image above). However, the movement lag on the spring arms is not exactly what I want.

Does anyone have an idea for how this might work best? What I really want is a stretchy attachment of some sort that does not immediately update the location of the child actor. Would physics constraints do this?

Add a preset delay before your AIs follow logic fires?

Not a bad idea, but I need the sockets to catch up at some point so that the player and AI are side by side. I just don’t want it to be 100% accurate. I’m going to attempt adding lag using the method for camera lag in this video: https://www.youtube.com/watch?v=QPms7QwNdcg

I’ll report back on my findings.

Yeah, it worked. I ended up having two scene components in my Character BP, and these were used as locations for my socket actors to move to.

a4ea978437e764ec3e5c2ea31177bd7d101ebf46.png

I spawn the socket actors in my GameMode BP, and spawn one of them to each scene component in the Character BP. The tick logic in the Socket BP (above) then moves the Socket Actors to their associated location, using the interp speed on TInterp as the lag.