Ok, so here's my situation. I have these "wave" objects, representing ocean waves. They have the private variables MomentumUp, MomentumDown, MomentumRight, and MomentumLeft. Amogn others, but those are the relevant ones.
I want to set it up so that if two of these waves collide (overlap, in this case; it's grid-based), they combine into one. I need to do things like add their MomentumDown variables together, or use their opposing momentums - left and right - to cancel each other out.
What I need, in pseudocode:
-WaveA and WaveB collide.
-Spawn CombinedWave.
-CombinedWave Momentum = WaveAMomentum+WaveBMomentum
The problem I'm running into is that, since all three of these objects - WaveA, WaveB, and CombinedWave - are instances of the same class, I have no idea how to differentiate between their variables within the same equation. I know how to do it normally through manipulation of the SOL, but in this case I'd need to differentiate between at least WaveA and WaveB within the same equation, and the techniques I understand are not possible.
I can think of a way around this, involving saving these PVs in proxy variables that I CAN distinguish between, but the end result would be extremely convoluted and messy, and I'm sure there is a better way. I've read all of the documentation I can find on this subject, and searched the forums, but no luck for solving a circumstance like this.
I would really appreciate any advice. Thanks in advance!
EDIT: And if I somehow missed nice documentation on this very subject, then definitely link me to it! I feel like this must be something that people have run into before, and I'm likely just missing existing resources explaining it.