{"id":1258,"date":"2011-12-08T23:17:13","date_gmt":"2011-12-08T23:17:13","guid":{"rendered":"http:\/\/www.west-racing.com\/mf\/?page_id=1258"},"modified":"2012-01-09T22:05:59","modified_gmt":"2012-01-09T22:05:59","slug":"carpet-scroll","status":"publish","type":"page","link":"http:\/\/www.west-racing.com\/mf\/?page_id=1258","title":{"rendered":"Carpet &#038; Scroll"},"content":{"rendered":"<p><div class=\"message_box warning_box\">\n<p class=\"message_box_sign warning_box_sign\">Warning<\/p>\nThis page is still being written\n<\/div><br \/>\nThis will show you how to roll up a mesh and then use the Scroll.cs helper script to make a dynamic scroll system.<\/p>\n<h3>Rolling up a carpet<\/h3>\n<p><a href=\"http:\/\/www.west-racing.com\/mf\/?attachment_id=129\" rel=\"attachment wp-att-129\"><img loading=\"lazy\" src=\"http:\/\/www.west-racing.com\/mf\/wp-content\/uploads\/2011\/11\/scroll-300x179.jpg\" alt=\"\" title=\"scroll\" width=\"300\" height=\"179\" class=\"alignright size-medium wp-image-129 fancy\" srcset=\"http:\/\/www.west-racing.com\/mf\/wp-content\/uploads\/2011\/11\/scroll-300x179.jpg 300w, http:\/\/www.west-racing.com\/mf\/wp-content\/uploads\/2011\/11\/scroll-1024x613.jpg 1024w, http:\/\/www.west-racing.com\/mf\/wp-content\/uploads\/2011\/11\/scroll-680x407.jpg 680w, http:\/\/www.west-racing.com\/mf\/wp-content\/uploads\/2011\/11\/scroll.jpg 1201w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3>Making a Scroll<\/h3>\n<p>This is a simple script that you can add to a gameobject that already has two bends applied that have been setup to roll the mesh from each end as shown above, the pos param will then control what part of the scroll is unrolled with the gap value giving the distance between the two ends.<\/p>\n<h3>Params<\/h3>\n<h4><strong>Pos<\/strong><\/h4>\n<p>How far along the scroll we want to display, 0 is fully rolled up unread scroll, 100 is fully rolled up read scroll.<\/p>\n<h4><strong>Gap<\/strong><\/h4>\n<p>The distance between the two rolls.<\/p>\n<h3>Scroll.cs<\/h3>\n<p>[cc lang=&#8221;c#&#8221;]using UnityEngine;<\/p>\n<p>[ExecuteInEditMode]<br \/>\npublic class Scroll : MonoBehaviour<br \/>\n{<br \/>\n\tpublic float pos = 0.0f;<br \/>\n\tpublic float gap = 0.5f;<\/p>\n<p>\tpublic Vector3\twpos;<\/p>\n<p>\tMegaBend[]\tbends;<\/p>\n<p>\tvoid Update()<br \/>\n\t{<br \/>\n\t\tif ( bends == null )<br \/>\n\t\t{<br \/>\n\t\t\tbends = GetComponents<MegaBend>();<br \/>\n\t\t}<\/p>\n<p>\t\tbends[1].gizmoPos.x = pos &#8211; gap;<br \/>\n\t\tbends[0].gizmoPos.x = pos + gap;<\/p>\n<p>\t\tVector3 p = transform.position;<\/p>\n<p>\t\tp.x = wpos.x + pos;<br \/>\n\t\ttransform.position = p;<br \/>\n\t}<br \/>\n}[\/cc]<br \/>\n<a href=\"http:\/\/www.youtube.com\/watch?v=4-450kR3E4Q&#038;hd=1&#038;fs=1&#038;autoplay=1\" class=\"fancybox-youtube\"><img loading=\"lazy\" src=\"http:\/\/www.west-racing.com\/mf\/wp-content\/uploads\/2011\/12\/ytscroll.png\" alt=\"\" title=\"ytscroll\" width=\"680\" height=\"383\" class=\"aligncenter size-full wp-image-1380 fancy\" srcset=\"http:\/\/www.west-racing.com\/mf\/wp-content\/uploads\/2011\/12\/ytscroll.png 680w, http:\/\/www.west-racing.com\/mf\/wp-content\/uploads\/2011\/12\/ytscroll-300x168.png 300w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This will show you how to roll up a mesh and then use the Scroll.cs helper script to make a dynamic scroll system. Rolling up a carpet Making a Scroll [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":299,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=\/wp\/v2\/pages\/1258"}],"collection":[{"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1258"}],"version-history":[{"count":34,"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=\/wp\/v2\/pages\/1258\/revisions"}],"predecessor-version":[{"id":1663,"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=\/wp\/v2\/pages\/1258\/revisions\/1663"}],"up":[{"embeddable":true,"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=\/wp\/v2\/pages\/299"}],"wp:attachment":[{"href":"http:\/\/www.west-racing.com\/mf\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}