- Home /
How To Ignore Specific Collider? - Blood Splatter
Hello,
I have a blood splatter asset that I found lying around the Interweb. The blood splatter lies itself over any collider that it comes in contact with. The problem is, I have some colliders that are invisible - and I want the blood splatter to ignore that.
I have added that specific collider into a Layer called 'Collider' (layer 8). Now, how would I tell my blood splatter script to ignore it?
var drip : GameObject; var hit : RaycastHit;
function Awake () { var x = -1; var drops = Random.Range (40, 80);
while (x <= drops)
{
x ++;
var fwd = transform.TransformDirection (Random.onUnitSphere * 5);
if (Physics.Raycast (transform.position, fwd, hit, 10))
{
splatter = Instantiate (drip, hit.point + (hit.normal * 0.1), Quaternion.FromToRotation (Vector3.up, hit.normal));
var scaler = Random.value;
splatter.transform.localScale.x *= scaler;
splatter.transform.localScale.z *= scaler;
var rater = Random.Range (0, 359);
splatter.transform.RotateAround (hit.point, hit.normal, rater);
Destroy (splatter, 5);
}
}
}
Thanks for your help.
Answer by Jessy · Jan 26, 2011 at 08:43 PM
You're leaving out the last parameter of Raycast. For your case, don't.
Right - so what would I put to Ignore 'Collider' layer?
You would begin by visiting the "Layer mask" link on that page, and then read the section "Casting Rays Selectively".
Humm, maybe its not to do with my raycast layer - it still splats blood against the colliders
Your answer
Follow this Question
Related Questions
Raycast not ignoring layer 0 Answers
blood damage like call of duty? 2 Answers
RTS Object selection Ignoring Colliders 2 Answers
how to ignore transparency of image when clicking/raycasting on it in 2D/uGUI? 0 Answers
Enabling / Disabling Collider Help 1 Answer