Download

OnComponentHit value for Set Morph Target - "add only" instead of "overwrite"?

Hey everyone,

I’m running into a bit of a problem with my vehicle damage model right now.

I’ve managed to get bone-specific collisions to work, so only those parts of my vehicle that collide will
be morphed on impact.

Also, thanks to “Get Velocity” and “Get Mass”, I was able to generate input for my Set Morph Target Value (that I’ve originally clamped
to stay between 0.1 and 1.0, although it’s not even necessary really).

NOW. My only problem at this point is that, whenever my vehicle “hits”, OnComponentHit will fire an output and overwrite the Morph Target value.

Meaning: when I hit an object at 80 mp/h, the morph damage is set to around 0.8 (= 80% “damaged”).

When I hit another object at a speed of 20 mp/h, the morph damage will be set to 0.2 (so “less damaged” than before).

Is there a way to set the On Component Hit events to “only add” to each other instead of overwriting the old value with the new one?

Or, as a minimum solution, ignore additional hits if their value is lower than the “current” value?

I hope this makes enough sense. I’m having a hard time wrapping my mind around this lol.

Thanks in advance for any help you can give me.a457bc94af5fa00692be126f2267813a1ce614c8.jpeg

Cheers,

Albatros

If I understand you correctly you should be able to make new “Float” variable… Make that variable “Damaged Value” (or something like that) and set it’s default to zero.
From that clamp drag off and use “+” or “add” and add it to your “Damaged Value”…clamp it again if you’d like or set it up before the clamp, depends on what’s going on in your game. Set the “Damaged Value” after you add the incoming value to the old “damaged value” variable. Use that to variable in your Set Morph Target “value”…

For no good reason I’ll explain more…
so the logic should be incoming damage will be say .5 and you’ll set the “Damaged Value” to .5 right before “set morph target” so the “Damaged Value” variable plugged into “value” will set it to .5
the next crash will be say .25 damage and it’ll add .25 to the current value of “Damaged Value” so .75 and that’ll return to “set morph target” since you’ve set it right before calling it…
I explained more in case this helps someone else I guess but I assume you gots this…

Good luck…