Im building a complex health system for my game and event found many tutorials for what I’m trying to achieve so it’s hard to know if Im doing things right.
So far Im using components for both the health and dealing damage.
My current issue is when a client tries to deal damage to anyone it only wants to apply damage to a certain character (no matter what character is being hit) Heres my code.
On my character that can attack I have this code it uses the deal damage component:
Turns out my line trace was casting from the wrong camera, ended up just hitting the same character. Instead I traded out camera manager for the exact location and rotation of the camera being used. I assume there are some issues getting camera manager form multiple clients.
Now the problem is i can’t getthe correct rotation of where the camera is looking
Do Not pass camera to the server. It opens the door for cheating. Server needs to get its own references and execute logic based on authoritative transforms.
To apply damage correctly you should use the engine functions. Apply Damage, Apply Point Damage etc.