Download

My Ships X value gets displaced over time

I’m doing a Front-View sort of game so I only use two planes.

The Y-axis is 1 for everything, X is back and Forth and Z is up and down. The ships plane movement is constrained to Y and that seems to work fine. The player can move up and down the Z axis. That works fine too.
As I hit things coming at me though, it seems that the ship at random have it’s X value changed to go backwards even though this should be impossible.

Does anyone have a clue as to why this behaviour happens?

737d03b096d5cc8e0821db3b07cdad00ddd25518.png
7b97cbc2f4c98ca7c07fb590c375bd72bbeff7e3.png

I can only guess…

My guess is that you’re using sphere collision in physics on your ship, and objects which don’t hit your ship straight on are creating a glancing blow. The physics simulation is applying an impulse which contains an X, Y, Z component, and the X value is non-zero.

This is pretty easy to test, just create a few objects which hit your ship at various positions on its collision sphere and see what the resulting impulse velocity is.

If this isn’t the behavior you want, you may want to use the collision sphere to only do “overlap” events and turn off physics simulation. You can implement that part yourself in blueprints.

Alright I’ll look around.