Hi there guys, right now i’m trying to recreate the typical OneWayPlattforms from 2d games and i have found an issue that i don’t know how to solve without patching.
My setup is the following.
I have a character that has a Trigger which responds to a Custom Object Channel called OWP (oneWayPlattforms), the trigger is only on the upper side of the character so whenever a OWP triggers it, the characters sets that plattform to be ignored until it ends the overlap.
If the character is falling onto a OWP, the box collision doesn’t trigger and the characters lands on the plattform.
The big box on top is the trigger, other triggers are for other uses and i have them as test right now.
Do mind the low fps on the right… i’m trying to check if the movement is the same on lower end systems… and i have found the following problem.
When the character jumps and tries to “pass through” an OWP that is on a specific distance, the character will STOP, because the movement is stopped before the trigger is activated.
Now i’ve been checking the source code for the character movement component and this is due the MaxSimulationStepTime variable, i have set the step to be no more than 1/60 seconds (60fps) to mantain physics on the character equal on each machine (as posible).
The problem is that, on the methods of the CharacterMovementComponent, specially PhysFalling, the simulation iterates until it has accomplished that low fps. In this case, each PhysSomething will iterate 4 times to reach at least 60fps. The problem is that, this is all done in a while loop, and it seems to take precende over the activation of the trigger. This is:
The simulation does its 4 loops to move the character, and in the 2nd or third frame of the movement, the character hits the OWP (which hasn’t been disabled as of yet) and the movement stops… after this, the PhysSimulation completes its cycle and the OWP is disabled, but the velocity has already changed and the character falls, witouth penetrating the OWP.
If one changes the altitude of the OWP slighty, this problem solves, because the hit doesn’t ocurr on those frames of the simulation… but at the same time it becomes a problem to other system that may simulate at different frames per second.
Right now i’m torn between trying to see how to make the trigger take precedence over the simulation, or to try to “pre simulate” the falling to check if it will hit a OWP “head first” as to deactivate it, via a SweepSingleByChannel.