Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Direction of Increasing Userdata per-particle
#5
Very helpful userdata description, thank you.

Quote:dataDelta and distA2B will always have the same sign since they're both calculated by subtracting particleB data from particleA, so they're both either negative or positive. This is a problem when multiplying them together, because (+)*(+) = (+) and (-)*(-) = (+). Since your formula does not preserve the sign of distA2B, oneDeltaA2B will randomly point in the direction of distA2B or the opposite direction depending on particle ordering.
I think this is fine because I want the per-particle Direction to point towards Increasing userdata. If data decreases (-) towards a negative vector (-) then the Direction should point towards positive vector(+). If there is (-) towards (+), then now we do want to go towards (-).

Perhaps I need to store all of these direction*deltas for a later per-particle job, and that magically cleans up the vectors?

dataDelta is the diff of PlayerInput between particles A and B, read from each particle's userdata[1][0] (where [1] is the custom 2nd vec4 allocated for this particle's userdata)
The picture of the slime moving to the right shows colorized PlayerInput, with 1 (red) being written near the Blue VFX. PlayerInput fades to 0 (blue), and every particle is storing PlayerInput deltas with interacting particles.

The "Userdata details" window shows 12 enum items, 8 of which are addressable in Userdata, and 4 which are not. It also confirms that PlayerInput of any particle is at userdata[1][0]
Likewise, in the Densities job we target this userdata by setting iOfAnyVec4 = 1 and iInVec4 = 0.


Attached Files Thumbnail(s)
       
Reply


Messages In This Thread
RE: Getting Direction of Increasing Userdata per-particle - by slimedev - 23-11-2023, 08:03 PM