{"id":3679,"date":"2015-03-11T23:53:24","date_gmt":"2015-03-11T20:53:24","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=3679"},"modified":"2015-03-11T23:55:07","modified_gmt":"2015-03-11T20:55:07","slug":"pointeffector2d","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2015\/03\/11\/pointeffector2d\/","title":{"rendered":"PointEffector2D"},"content":{"rendered":"<p>Unity5 comes with new <a title=\"http:\/\/docs.unity3d.com\/ScriptReference\/PointEffector2D.html\" href=\"http:\/\/docs.unity3d.com\/ScriptReference\/PointEffector2D.html\" target=\"_blank\">PointEffector2D<\/a><\/p>\n<p>How to use it?<br \/>\n&#8211; Add sprite to scene<br \/>\n&#8211; Add CircleCollider2D (or some other 2D collider)<br \/>\n&#8211; Enable: [x] Trigger *Note: Effector works without trigger enabled also, but only when other object is touching the collider.<br \/>\n&#8211; Enable [x] Used by Effector<br \/>\n&#8211; Add PointEffector2D component<br \/>\n&#8211; Adjust Force magnitude (if it doesnt seem to affect enough, <strong>negative values will attract<\/strong> and<strong> positive values will repel<\/strong> objects away)<\/p>\n<p>Then just add other objects that the effector will affect:<br \/>\n&#8211; Add sprite<br \/>\n&#8211; Add rigidbody2D<br \/>\n&#8211; Add CircleCollider2D (or some other 2D collider)<\/p>\n<p>Image#1: Point effector, note the circle collider radius is adjusted, that is the area it affects.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3681\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2015\/03\/11\/pointeffector2d\/point_effector2d_1\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_1.jpg?fit=718%2C609&amp;ssl=1\" data-orig-size=\"718,609\" 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;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"point_effector2d_1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_1.jpg?fit=300%2C254&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_1.jpg?fit=718%2C609&amp;ssl=1\" class=\"alignnone size-full wp-image-3681\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_1.jpg?resize=718%2C609\" alt=\"point_effector2d_1\" width=\"718\" height=\"609\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_1.jpg?w=718&amp;ssl=1 718w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_1.jpg?resize=300%2C254&amp;ssl=1 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/p>\n<p>&#8212;<\/p>\n<p>Image#2: normal object with collider2D and rigidbody2D, when it enters point effector area, it gets affected by it<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3680\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2015\/03\/11\/pointeffector2d\/point_effector2d_2\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_2.jpg?fit=520%2C608&amp;ssl=1\" data-orig-size=\"520,608\" 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;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"point_effector2d_2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_2.jpg?fit=257%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_2.jpg?fit=520%2C608&amp;ssl=1\" class=\"alignnone size-full wp-image-3680\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_2.jpg?resize=520%2C608\" alt=\"point_effector2d_2\" width=\"520\" height=\"608\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_2.jpg?w=520&amp;ssl=1 520w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_2.jpg?resize=257%2C300&amp;ssl=1 257w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/p>\n<p>&#8212;<\/p>\n<p>Results for the settings above:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2D.gif\" target=\"_blank\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3682\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2015\/03\/11\/pointeffector2d\/point_effector2d\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2D.gif?fit=351%2C392&amp;ssl=1\" data-orig-size=\"351,392\" 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;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"point_effector2D\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2D.gif?fit=269%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2D.gif?fit=351%2C392&amp;ssl=1\" class=\"alignnone size-full wp-image-3682\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2D.gif?resize=351%2C392\" alt=\"point_effector2D\" width=\"351\" height=\"392\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unity5 comes with new PointEffector2D How to use it? &#8211; Add sprite to scene &#8211; Add CircleCollider2D (or some other 2D collider) &#8211; Enable: [x] Trigger *Note: Effector works without trigger enabled also, but only when other object is touching the collider. &#8211; Enable [x] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3681,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_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}},"categories":[420,3],"tags":[65,720,228,719,71,70,477],"class_list":["post-3679","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-unity3d","tag-2d","tag-gravity","tag-physics","tag-pointeffector2d","tag-pull","tag-push","tag-repel"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/03\/point_effector2d_1.jpg?fit=718%2C609&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-Xl","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/3679","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=3679"}],"version-history":[{"count":3,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/3679\/revisions"}],"predecessor-version":[{"id":3685,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/3679\/revisions\/3685"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/3681"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=3679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=3679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=3679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}