Hello everyone,
I think that this is my first message in the forum asking for help, and I don’t know if this issue is more related with the rendering part or it has something to do with the coding section, so I apologize if this is not the right place to ask…
I’m trying to recreate the classic pacman and after tweak arround with skeletal meshes and animations and several failed attempts, i’ve decided to use two independent static meshes for my character: one with the mouth open and one with the mouth closed, and then each 50ms swap the visibility of both meshes, and without movement it looks pretty good, but when I’ve started moving arround a blink effect appear to my player.
pacman.mkv (2.7 MB)
I’ve tryed with timers, with tick updates, with different methods ToggleVisibility, SetVisibility, SetActorHiddenInGame, … and all produces the same blinking effect. Maybe it has something to do with the rendering part or is the method I’m using to update the player position. I really don’t know where to start touching to achive the effect that I’ve wanted swapping the mesh smoothly without any frame without seeing the player mesh
If it’s needed I’ve leave the code for the tick method:
void APocmanController::Tick(float DeltaTime) {
Super::Tick(DeltaTime);
if (!MovementDirection.IsZero())
SetActorLocation(GetActorLocation() + DeltaTime * MovementSpeed * MovementDirection);
swapMeshesTimeout += DeltaTime;
if (swapMeshesTimeout > 0.25f) {
swapMeshesTimeout = 0;
MeshClose->ToggleVisibility();
MeshOpen->ToggleVisibility();
}
}
Thanks for the help!
