moving an object to keep up with camera

I have created my own 3D UI as an actor that has meshes and every frame I place it in front of the camera by changing world location and rotation. I am using a PlayerCameraManager

This works well except it seems to lag behind the camera by a frame sometimes. This gives it a very jittery effect and makes it feel like the whole game is jittery.

I don’t know how to change it’s location until after the camera moves because it works well as far as an UI goes, and is easy for me to modify as it uses the same things I am used to with in-game actors, meshes etc

A while ago I had an idea to actually use the PlayerCameraManager do this itself, by adding mesh components to itself in front of the camera (this way they would always move with the camera) but I didn’t have much success with them showing up

I’m no pro, but i feel like using meshes for your HUD might not be the best way. They have a bunch of math for collision, polys, materials, textures, physics, and there’s other settings behind meshes. All of which take a little away from performance. Id stick with drawing images or playing videos on the HUD. It could be lagging just because of the calculations.

you could try adding your UI meshes as components of an Actor, then add that Actor as a childActorComponent parented to the camera of your pawn.

Doubtful, UE4 + my PC is a very powerful combination, this is nothing compared to what it can pull off. If your comment was true the frame rate would suffer

I’ve never looked at childactorcomponent, I don’t even know how it works BUT based on the name etc, it might work perfectly.

My components ARE already their own actor, it’s how I manage them. Thanks for this, this might fix the situation entirely with little effort or changing my HUD actor


True, but I know it will burn more resources even if it might not be noticeable.

maybe not, it really depends on the meshes used. if you used simple low poly meshes with a simple material that has solid colors going to an emmisive channel, and you set it up as an additive blending mode, and set the collision to ignore all and didn’t use physics or collision meshes, it can be very cheap to render geometry, and it might even be cheaper than rendering textures onto the screen, depending on the resolution of the texture and its transparency settings. if you wanted really sharp solid polygonal shapes that look good from any distance, doing it with geometry might be cheaper than using high enough resolution textures + transparency to achieve those details.

but either way, optimization should usually be in response to bottlenecks, and if geometry rendering is slowing down your game, you should start by optimizing your main materials and your most commonly instanced meshes, and using precomputedVisibilityVolumes and LODs to control culling.

also, if you ever played an FPS, the first person gun meshes can be as dense as a character model, with a series of animations and high resolution textures, and that is attached to the camera in the same way a HUD would be, so if it was a performance problem to attach meshes to your character, FPS games would need 2D weapon sprites like doom.

this working f’n flawlessly, thanks. it took about 5 minutes, I added the component, set the offset same as last time and it must have been a credit to how I had set up my HuD class because it worked first time, only had to rotate 180 and now its steady as a rock compared to the screen but moves through the game. you have no idea how great this is for me!!!

good points. there is no collision and I have no textures in my game either, just simple materials