Squid-like movement component for a pawn

I’m trying to implement a squid-like movement component for a non-player pawn using blueprints. That is, an initial impulse towards the forward direction and a slow down on 3d space, followed by a turn and another impulse.

Ideally I wanted to create a movement component that I could drop to any child of my base Pawn class so that it moves in this fashion. It should push dynamic objects, stop or glide over static objects.

Maybe in the future I would like to implement more complex behaviors, maybe behavior trees, but I’d say it’s outside the scope of this question.

I’ve tried a myriad of things to get this working (+ collisions) to no avail. The list of what I’ve tried is long:

  • Using a custom movement component (ideal)
  • Using FloatPawnMovement, the ProjectilePawnMovement
  • Using an Actor, a Pawn or a DefaultPawn
  • AIMoveTo, ActorLocalOffset, AddLocalOffset, SetActorLocation or AddMovementInput
  • Turning on/off physics, changing to collisions to BlockAll, …
  • Using the default AIController, creating a custom AIController, not setting an AIController
  • … I no longer know

Sometimes I got the movement to work, for example using a curve to model the velocity or the location of the actor/pawn (ActorLocalOffset with Sweep). But then collisions with static world meshes only worked if the Capsule was the root component, but children should be able to have different capsules, which means the root component is the default and I couldn’t find the collisions setting and even if I did, it would not be the right size. The only solution I can think at the moment is to raytrace before the movement to just not go in the static meshes, but I feel that’s not how it’s supposed to be done.

If I change the Updated Component to the capsule, then the root component is left behind since movement affects the capsule but not the root.

Most tutorials I’ve seen regarding enemies use the navmesh and characters, but it doesn’t apply in my case since the movement is “flying” so it isn’t necessary.

How would you go with this and/or what am I doing wrong? I can create a Minimum Working Example with several tries of mine if it helps, I’m afraid my description might be too abstract as-is, but I think if I can get some advice on the way to go I can try something and post my failure for further comments.

I’m using a C++ project, so a C++ solution would also work for me. I’m mainly using blueprints because I’m not familiar enough with Unreal Engine.

This might be hacky as heck and originally I wasn’t going to answer, but it kind of stuck in my head and I couldn’t help but thinking of any sort of solution.

I remember years ago when I was first learning UE I made a ridiculous “flying pawn” that was just a regular walking pawn. If i remember correctly I used a tall volume and measured the actor’s location on the Z axis within the volume.
I then would move the skeletal mesh higher up on the Z axis when the volume overlapped with another object. I think I used sockets on the meshes to get the top most height of the object. With some blendspaces you could do some cool stuff with it.

Also as far as the collision issue goes, say for example you use a standard pawn and not a flying one, you could set the collision to the sapsule component to ignore everything but the terrain, but then change the collision to block whatever you need to on an additional capsule you can attach to your skeletal mesh. So the character can move around freely, but will collide in the air with objects if say perhaps it doesn’t get above it quickly enough.

While that might not help you at all, maybe it can help get you onto another train of thought

Thanks for digging in! At least I’m not alone in the struggle. My pawn moves in 3D so this wouldn’t work. However maybe the engine is just not nice with this and I do have to hack it (like with the raytrace idea to prevent colliding manually or ditching the inheritance so a capsule si the root component. Thanks for weighing in! It helps getting over desperation.