|
Post by idealgfdeveloper on Feb 23, 2018 16:24:54 GMT
How can i add the damage via particle? Currently i'm calling the damage reception from the ragdoll collision, but seems like the ragdoll don't even call it's own TakeDamage message, i've tried many things but i can't get it to work. This is my current code:
vDamage damage = new vDamage((int)skillData.damage) { hitPosition = collPoint, sender = transform }; other.ApplyDamage(damage); The "other" GameObject is provided by the OnParticleCollision(GameObject other) event and the collPoint is provided by the ParticleSystem events.
p.d i think i posted in the wrong forum.
|
|
|
Post by jrackley on Feb 23, 2018 21:10:16 GMT
How can i add the damage via particle? Currently i'm calling the damage reception from the ragdoll collision, but seems like the ragdoll don't even call it's own TakeDamage message, i've tried many things but i can't get it to work. This is my current code: vDamage damage = new vDamage((int)skillData.damage) { hitPosition = collPoint, sender = transform }; other.ApplyDamage(damage); The "other" GameObject is provided by the OnParticleCollision(GameObject other) event and the collPoint is provided by the ParticleSystem events. p.d i think i posted in the wrong forum. On the particle you need to make sure that it is world space and in the collision option add your layers that you want it to collide with, also be sure that send message is enabled on the particle as well. For the damage you should try something more like... var _damage = new vDamage(skillData.damage); _damage.sender = transform; _damage.hitPosition = collPoint.transform.position;
Also yes this needs to be moved to the appropriate channel please tharindu
|
|
|
Post by tharindu on Feb 24, 2018 2:32:18 GMT
Moved to general discussion. Thanks jrackley
|
|
|
Post by idealgfdeveloper on Feb 25, 2018 1:37:48 GMT
Ok guys thanks for the help but i created a custom solution, it's weird but the collision denies to receive the damage event.
vCollisionMessage message = other.GetComponent<vCollisionMessage>(); int damageAmount = skillData.damage; if (message != null) damageAmount = Mathf.RoundToInt(damageAmount * message.damageMultiplier); vDamage damage = new vDamage(damageAmount) { hitPosition = collPoint, sender = transform }; vThirdPersonMotor motor = other.GetComponentInParent<vThirdPersonMotor>(); if (motor != null) motor.gameObject.ApplyDamage(damage); If someone knows a better way to do it I would be very grateful because just doing ApplyDamage to the collision object never worked for me.
|
|