Can I set the direction of an impact force?

Lavos

Member
Hi, is there a way to set the direction of the impact force for a melee weapon? I would like to use a pretty important value (around 50). Currently, the enemy is projected in random directions (corresponding to the direction of the impact), sometimes even in the sky... I just want the impact to push back the agent in the direction the player is facing. How can I achieve this with the UCC?
 
Not out-of-the-box, but should be easy with some minor script modification. MeleeWeapon.HitCollider is where the impact force is applied to the hit collider - the direction is based on the normal of the surface that was hit. So you could easily enough replace raycastHit.normal with a specific direction, e.g. the forward direction of the character.
 
I changed MeleeWeapon.cs HitCollider to use:

hitHealth.Damage(damageAmount, raycastHit.point, m_CharacterLocomotion.transform.forward,
m_ImpactForce,
m_ImpactForceFrames,
0, m_Character, this, hitCollider);

Instead of -raycastHit.normal
 
Top