On click mouse down I spawn a “hollow” (translucent) version of a projectile at the muzzle point, where an actual flying projectile will spawn on mouse release. As my character moves, the attached actor moves with him, but it has a horrible shake to it. Maybe this gif will help me better describe my problem.
This project is based on First Person Shooter template. I spawn and attach the disc in C++:
HollowProjectile = SpawnHollowProjectile(HollowProjectileClass);
// Attach the spawned hollow projectile to FP_MuzzleLocation, keep relative and weld
HollowProjectile->AttachToComponent(FP_MuzzleLocation, FAttachmentTransformRules(EAttachmentRule::KeepRelative, true));
// adjust the location by an editable FVector
HollowProjectile->SetActorRelativeLocation(RelativeHollowLocation);
I tried updating the actor location in it’s own tick method, but the result was the same.
Hm. Maybe the texture coords are updating one or two frames behind the world render. If that’s the case maybe you can offset them by the delta rotation? Sorry I don’t know if I’m even close, I have very little Materials experience.
I think this behavior is due to the tick order of the actors: The Character is ticked before the projectile and the camera (angle and position) is part of that character. Then the projectile is moved producing the “shaking”. (I might be wrong on the particular order)
There are several things you can try:
Don’t attach the projectile actor. Attach only projectiles’s mesh to the character and hide it the moment you fire (and spawn) the projectile. (simplest and most elegant solution)
Change the projectile TickGroup so it is ticked before the Camera (Character). (might mess with physics/cloth)
AddPrerequisite to the Character to tick after the projectile. (might produce input lag)
Thank you for the answer. I tried changing the tick groups and it didn’t help. I also attached the static mesh to the camera, capsule, gun, … all with the same result. Even if I make the disc a skeletal mesh, and I attach it to the player character I still get the jittering movement of the disc
Thank you for trying, but I’ve decided to find a different approach to the game.
I have found the issue, it was the translucency of the material used. As soon I make the material opaque it all starts to behave splendidly Right now I am not sure if this is a bug or the shaking is just a price for the translucent materials.
Well, i might just resurect some dead posts, but for anyone landing here after some google search, you can keep your translucent materials. It’s just an issue you might had with motion blur.
In my case :
I just select my Post Process Volum in my Scene.
I Checked motion blur Amount and put it to 0.
You can also disable Motion Blur in Project Settings.
It fixed the problem i had so i hope it will help.
Using 4.25.4
PS : sorry for my english it’s not my native language.