I'm attempting to create a rain particle effect and I have most of it set up. The issue I'm having is that the collision system I have set up does not seem to hit objects accurately, for example; I have a mesh of a car and the rain particle effect is intended to hit the roof of the car and die. This does not happen, what instead happens is the rain will pass through the roof of the car and hit the bottom where it will then be destroyed.
Rather than using the normal physics collision that is provided in the physics & Collision nodes, I use this script in the evolvers script node;
function void Eval()
float3 raycastStart = StartPosition;
float3 raycastStop = Position;
float3 raycastVec = raycastStop - raycastStart;
float3 raycastDir = safe_normalize(raycastVec, raycastVec);
float raycastDist = length(raycastVec);
int4 hit = scene.intersectExt(raycastStart,
float hitDist = scene.unpackDist(hit);
int SurfaceTypeID = scene.unpackSurfaceType(hit);
float3 hitPosition = raycastStart + raycastDir * hitDist;
float3 hitUp = scene.unpackNormal(hit);
float3 hitForward = cross(float3suf(0, -hit.f, hit.u + 0.01), hitUp);
int con = isfinite(hitDist);
is there anything else I can do to improve the accuracy of the collisions or am I missing something that is required for this to work effectively?