{"id":43,"date":"2013-03-19T21:09:33","date_gmt":"2013-03-19T21:09:33","guid":{"rendered":"http:\/\/lotecsoftware.com\/unity\/blog\/?page_id=43"},"modified":"2013-03-19T21:09:33","modified_gmt":"2013-03-19T21:09:33","slug":"movingplatform","status":"publish","type":"page","link":"http:\/\/lotecsoftware.com\/unity\/blog\/?page_id=43","title":{"rendered":"MovingPlatform"},"content":{"rendered":"\n<pre class=\"lang:c# decode:true \" >\/**\r\n * Add to a moving platform, along with a Box Collider for\r\n * trigging only when an object is on top of the platform.\r\n * *\/\r\nusing UnityEngine;\r\nusing System.Collections;\r\n\r\npublic class MovingPlatform: MonoBehaviour {\r\n\t\/\/ TODO: Add objects on platform to an array.\r\n\t\/\/ Save old parent on enter, reattach old parent on exit.\r\n\t\t\r\n\tvoid OnTriggerEnter(Collider other) {\r\n\t\tother.transform.parent = gameObject.transform;\r\n\t}\r\n\r\n\tvoid OnTriggerExit(Collider other) {\r\n\t\tother.transform.parent = null;\r\n\t}\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/** * Add to a moving platform, along with a Box Collider for * trigging only when an object is on top of the platform. * *\/ using UnityEngine; using System.Collections; public class MovingPlatform: MonoBehaviour { \/\/ TODO: Add objects on platform to an array. \/\/ Save old parent on enter, reattach old parent on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/lotecsoftware.com\/unity\/blog\/index.php?rest_route=\/wp\/v2\/pages\/43"}],"collection":[{"href":"http:\/\/lotecsoftware.com\/unity\/blog\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/lotecsoftware.com\/unity\/blog\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/lotecsoftware.com\/unity\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/lotecsoftware.com\/unity\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=43"}],"version-history":[{"count":0,"href":"http:\/\/lotecsoftware.com\/unity\/blog\/index.php?rest_route=\/wp\/v2\/pages\/43\/revisions"}],"wp:attachment":[{"href":"http:\/\/lotecsoftware.com\/unity\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}