I’m trying to create a small spaceship behaving with some inertia. Using “Add Movement Input” and the “floatingPawnMovement” component, I get the desired effect but only for forward and backward. However, I can’t seem to be able to use that same function to do smooth rotations.
Note that the camera just follows the ship location, but not rotation. The camera is set at a 3/4 45° top-down style.
I’ve looked everywhere and so far I cannot find a single example of smooth rotations using the same built-in behavior has the Add Movement Input + floatinGPawnMovement combo… It’s always some workaround with lerp and such.
What I’m looking for is EXACTLY what they have in this video, at 3:44, with both inertia for all movements and a static camera that just follows the ship around.
Hello @Gnougnou ,welcome back to forums!
If I understood you correctly, this might help:
You could create an IA_MoveRight/Left input action of type Axis1D, configured so that A has a negative value (using the Negate modifier) and D has a positive value.
Then, use a Spring Arm properly set up for the camera. The Spring Arm does not add real inertia to the pawn’s rotation, but it does help make the camera movement feel smoother, especially when the rotation comes from player input.
It magically works for Forward and Backward because of the FloatingPawnMovement that allows me to set an acceleration, max speed, and stopping speed, but it doesn’t absolutely nothing for rotations.
Note that with this code, after rotating the ship, going forward or backward will keep going along the X axis, and ignore the ship forward vector, as currently I only multiply 1 or -1 with the World Direction. I’m gonna fix that, but this is beside the point of this thread
One of my issue is that because Forward and Backward currently magically happen while rotation doesn’t not, unless there is something I’m missing, it feels like I’m heading toward a half-homemade solution with rotation being made by me while acceleration/stop will be handled by magic in FloatingPawnMovement, which is something I absolutely want to avoid. Either FloatingPawnMovement has a built in smooth rotation feature included that I’m not seeing, either I’ll just do everything by myself so I have full control over my ship.
I ditched the FloatingPawnMovement, and replaced it with a PhysicsThruster, then activated physics on my ship, locked Z location so the ship stays on the same plane, locked X and Y rotation, and that’s about it. Linear and Angular Damping are exactly what I needed to simulate opposing thrusters and get smooth acceleration and braking.