A custom pawn of mine based on sphere collision + basic movement component ,similar to the floating one provided with the engine, presents 2 major collision issues against other moving actors(movable static meshes).
First scenario (moving objects against my still in position pawn)
When pawn’s velocity is 0 other moving actors (moved by matinee or by blueprint by add location offset with sweep) just penetrate and no hit is registered.
In PrimitiveComponent source code is stated that.
// ComponentSweepMulti does nothing if moving < KINDA_SMALL_NUMBER in distance, so it’s important to not try to sweep distances smaller than that. + there is many optimization on zero velocity that makes engine skip processin my pawn further.
So when my pawn not move how can I do to check for penetration and fix them?
Something like penetrated plane and distance along plane normal.
Scenario number 2
I made a horizontal scrolling shootemup prototype where I tryed to make player ship and other kind of actors move with the camera.
To make a trivial screen reference system I simply made a custom movement component to add camera actor velocity to a Screen Relative Velocity vector. Every object that needs to move relative to screen have this movement component in c++ or a similar setup made in blueprint.
Even If trivial all works flawlessly apart of a second penetration issue I spotted thanks to this setup.
When whatever moving object is still respect the screen even (it actual velocity is indeed equal to camera speed) my player pawn can actually traverse it when moving in a direction opposite to the camea ones.
This behaviour is speed sensitive if camera is scrolling slow and pawn is quite fast a collision is detected.
If pawn is slow or camera movement is quite fast (and so all the absolute velocities of the other object are high) no hit is detected. this seem to be a problem related to the first issue, but there no real still object is really involved and all works in the non scrolling direction es vertical collisions fully works when camera scrolls horizontally.
Possibly I can make a better prototype using a different technique to simulate a screen space reference system(suggestions are really well accepted), but I’m very curious to understand why my collision fails and how to fix them to have a more solid foundation about how collision works.
I’ will investigate on how based movement works in characters to make something similar to base my actor movment about the movement of the camera actor.