Character shoots itself in 3P view.

finaratic

Member
When i use third person sometimes i can aim at my character and shoot it. For example if too close to wall camera moves to characters head (my character heads are bigger than normal) and if you shoot it you get to damage yourself. How can i fix it? My guess is to make another layer, but i hope there is much easier fix. Thanks!
 
Well that's weird, because I recently worked on a character killing himself and I had to change the hitscan code because it actually makes sure that the character doesn't harm himself ! We'll need a bit more info :

-Are you using hitscans or projectiles ?
-On what layers are your character's main capsule collider and his ragdoll colliders, if he has any ?
-What impact layers do you have set on your hitscan or projectiles ?
-Lastly, you can also make a video to illustrate the situation, I think this could be helpful in your case.
 
First of all I am using second version of UCC, not the latest one since the project was originally on the 2 version.
I am using hitscan, layer for character is Character, rag doll on SubCharacter
Impact layers for weapons character, subcharacter, enemy and etc
My thought is just that when head appears on the crosshair you shoot with hitscan from the center of the screen and shoot the collider with layer character, but if I remove character layer from impact layers I will have issues in multiplayer ( no damage to other player maybe ?
 
You should know that V2 is deprecated, which means support from the devs isn't guaranteed. Now to answer your question, the origin of the hitscan sounds like the most probable explanation - select your weapon, open the Third Person Shootable Weapon Properties component and see if a correct transform is assigned in the Fire Location slot. Also take a look at Fire In Look Source Direction from Shootable Weapon -> Firing, setting it to false might be the best thing to do.
Hope this solves your issue !
 
You should know that V2 is deprecated, which means support from the devs isn't guaranteed. Now to answer your question, the origin of the hitscan sounds like the most probable explanation - select your weapon, open the Third Person Shootable Weapon Properties component and see if a correct transform is assigned in the Fire Location slot. Also take a look at Fire In Look Source Direction from Shootable Weapon -> Firing, setting it to false might be the best thing to do.
Hope this solves your issue !
Found issue in the code, damage processing were before it determined if the player char was hit in the ShootableWeapon script
 
Top