We have the Player Position (a vector world space collection parameter set on char tick), then we have the Actor Position (the location of the object with the material in world space) and we know the Camera Position (camera position in world space)
How can we find out if the Actor Position is in between the Player and Camera Positions within the material graph ?
Already tried various things without succes, is there a node that does this in material graph?
---- Update
Okay the thing is, get the distance between the camera and the player, get the distance between the camera and the actor with the material to finally get the difference between them…
So if the distance between the camera and actor is less than the distance between camera and the player we know that the object is between the camera and the player then !
Why are you masking the RGB channels of the player position immediately after the player position node? That’s cutting the XYZ coords out of it, thereby it is probably not calculating correctly because it doesn’t ‘see’ the player position in XYZ. You should also set Camera Position in the A pin for each Subtract node. So, subtract it this way:
Camera Position - Player Position (camera is in A, player is in B)
Camera Position - Actor Position (camera is in A, player is in B)
It’s probably part of why it’s not working.
The Abs node (Absolute Value) is connected to the 2Vector input on Vector Length, for each distance calculation. What’s that for? After that it’s not being used. I don’t know what the point of it was/is, but try disconnecting those in addition to rearranging the subtraction connections.
The reason to subtract with camera position in A, or first, and the other after is to get a forward vector reference (meaning the vector traveling from the camera forward into the scene, which will be utilized for comparing the two subtractions accurately, with the right reference for each in 3D space). However, it depends on the final result that’s intended too. I think it’ll be easier to work with camera in pin A. When those two calculations are done, and get absolute value is run for them, then vector length, it’s then another subtract needs to be run to determine the difference.