{"id":2098,"date":"2013-08-01T02:40:41","date_gmt":"2013-07-31T23:40:41","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=2098"},"modified":"2013-08-01T02:49:10","modified_gmt":"2013-07-31T23:49:10","slug":"testing-onparticlecollision","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2013\/08\/01\/testing-onparticlecollision\/","title":{"rendered":"Testing OnParticleCollision()"},"content":{"rendered":"<p><a title=\"http:\/\/unitycoder.com\/upload\/demos\/OnParticleCollisionWater1\/\" href=\"http:\/\/unitycoder.com\/upload\/demos\/OnParticleCollisionWater1\/\" target=\"_blank\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2099\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/08\/01\/testing-onparticlecollision\/shuriken_particle_collision_event_water_paint_unity\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/shuriken_particle_collision_event_water_paint_unity.jpg?fit=680%2C529&amp;ssl=1\" data-orig-size=\"680,529\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"shuriken_particle_collision_event_water_paint_unity\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/shuriken_particle_collision_event_water_paint_unity.jpg?fit=680%2C529&amp;ssl=1\" class=\"alignnone size-full wp-image-2099\" alt=\"shuriken_particle_collision_event_water_paint_unity\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/shuriken_particle_collision_event_water_paint_unity.jpg?resize=680%2C529\" width=\"680\" height=\"529\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/shuriken_particle_collision_event_water_paint_unity.jpg?w=680&amp;ssl=1 680w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/shuriken_particle_collision_event_water_paint_unity.jpg?resize=300%2C233&amp;ssl=1 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/a><\/p>\n<p>Testing the new 4.2 feature, shuriken particle collision event:<br \/>\n<a title=\"http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/MonoBehaviour.OnParticleCollision.html\" href=\"http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/MonoBehaviour.OnParticleCollision.html\" target=\"_blank\">http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/MonoBehaviour.OnParticleCollision.html<\/a><br \/>\nCollision event returns info from particle: Collider, intersection, normal, velocity<br \/>\n<a title=\"http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/ParticleSystem.CollisionEvent.html\" href=\"http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/ParticleSystem.CollisionEvent.html\" target=\"_blank\">http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/ParticleSystem.CollisionEvent.html<\/a><\/p>\n<p><strong>Features:<\/strong><br \/>\n&#8211; Tried to make the spray look like water..but that didnt work out yet..<br \/>\n&#8211; Particles hit the plane, and fire that OnParticleCollision event<br \/>\n&#8211; Paint on the hit position to add &#8220;water&#8221; on the stone texture (using extra raycast to hit position for now, not sure how to get texture position from world collision point..?)<br \/>\n&#8211; Press F to enable flow..(doesnt work nicely yet..)<br \/>\n&#8211; Original texture: <a title=\"http:\/\/www.cgtextures.com\/texview.php?id=56233\" href=\"http:\/\/www.cgtextures.com\/texview.php?id=56233\" target=\"_blank\">http:\/\/www.cgtextures.com\/texview.php?id=56233<\/a> (stone normal map was created with this <a title=\"http:\/\/unitycoder.com\/blog\/2013\/07\/16\/normal-specular-map-generator-from-texture\/\" href=\"http:\/\/unitycoder.com\/blog\/2013\/07\/16\/normal-specular-map-generator-from-texture\/\" target=\"_blank\">normal map plugin<\/a>)<br \/>\n&#8211; Water shader is modified from this <a title=\"http:\/\/unitycoder.com\/blog\/2012\/11\/07\/water-night-scene\/\" href=\"http:\/\/unitycoder.com\/blog\/2012\/11\/07\/water-night-scene\/\" target=\"_blank\">water night scene<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Webplayer:<\/strong><br \/>\n<a title=\"http:\/\/unitycoder.com\/upload\/demos\/OnParticleCollisionWater1\/\" href=\"http:\/\/unitycoder.com\/upload\/demos\/OnParticleCollisionWater1\/\" target=\"_blank\">http:\/\/unitycoder.com\/upload\/demos\/OnParticleCollisionWater1\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Testing the new 4.2 feature, shuriken particle collision event: http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/MonoBehaviour.OnParticleCollision.html Collision event returns info from particle: Collider, intersection, normal, velocity http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/ParticleSystem.CollisionEvent.html Features: &#8211; Tried to make the spray look like water..but that didnt work out yet.. &#8211; Particles hit the plane, and fire that OnParticleCollision [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2099,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[4,3],"tags":[515,516,514,34,182,14,183,518,60,517],"class_list":["post-2098","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-demos","category-unity3d","tag-4-2","tag-flow","tag-onparticlecollision","tag-paint","tag-particle","tag-shader","tag-shuriken","tag-stone","tag-water","tag-wet"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/shuriken_particle_collision_event_water_paint_unity.jpg?fit=680%2C529&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-xQ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=2098"}],"version-history":[{"count":2,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2098\/revisions"}],"predecessor-version":[{"id":2101,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2098\/revisions\/2101"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/2099"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=2098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=2098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=2098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}