Left Handed wielding of weapons

We are well on our way to making functional projectile weapons - something that we fell short of in the first iteration of this course.

2 Likes

Hi. In the Quiz 17 you have a mistake at the last question.


The correct answer (well… the one that would give us an error) should be the one with other.GameObject.tag and you can actually see in the right side of my print where is the problem. The answer selected is accepted as the right answer (but it’s not the right one in reality).

It’s better to use other.CompareTag("Player") anyway since it’s more efficient.

Good morning!
I just figured It could be cleaner to:

1- Make the isRightHanded bool public in Weapon.cs

[SerializeField] bool isRightHanded= true;
        public bool IsRightHanded {get{return isRightHanded;}}

        public void Spawn(Transform handTransform, Animator animator)
        {
            if(equippedWeaponPrefab != null)
            {
                Instantiate(equippedWeaponPrefab, handTransform);
            }
            if(weaponAnimationOverride != null)
            {
                animator.runtimeAnimatorController= weaponAnimationOverride;
            }
        }

2- Let the Fighter.cs handle the handling

[SerializeField] Transform leftHandTransform = null;
[SerializeField] Transform rightHandTransform = null;
public void EquipWeapon(Weapon weapon)
        {
            currentWeapon = weapon;
            Animator animator = GetComponent<Animator>();
            Transform handTransform;
            if(weapon.IsRightHanded) handTransform = rightHandTransform;
            else handTransform= leftHandTransform;
            weapon.Spawn(handTransform, animator);
        }

This could be a problem when we want to despawn a right handed weapon while we spawn a left handed weapon… (That might be self evident in a couple of lectures).

1 Like

Indeed. At least I will know where to fix

Just a bit of information…
The hand you would hold your bow in has nothing to do with you being left or right handed. It depends on which is your dominant eye.
You aim with your dominant eye and pull the string with the hand on the same side. So it is possible to be righthanded, with your left eye being dominant, so you would pull with your left hand and therefore hold the bow with your right hand.

Quite true. In our case, our animations all assume that the bow is in the left hand, meaning that by extension, our characters are right eye dominant. :slight_smile:

Privacy & Terms