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.