{"id":2283,"date":"2014-01-24T12:29:38","date_gmt":"2014-01-24T20:29:38","guid":{"rendered":"http:\/\/www.sprixelsoft.com\/?p=2283"},"modified":"2014-01-24T12:29:38","modified_gmt":"2014-01-24T20:29:38","slug":"jumping-off-walls","status":"publish","type":"post","link":"http:\/\/www.sprixelsoft.com\/?p=2283","title":{"rendered":"Jumping off Walls"},"content":{"rendered":"<p>I got up to learning more 2D platforming this week, though with a friend of 20+ years in town this week I&#8217;ve ended up doing far more touristy stuff this week than bi&#8217;ness. Actually, 2D platforming is a slight misnomer, as the stuff that I was working with this week was actually 3D.<\/p>\n<p>&nbsp;<\/p>\n<p><!--more--><\/p>\n<p>I tried to trouble shoot some of the problems that I was having <a href=\"http:\/\/www.sprixelsoft.com\/?p=2268\">last week<\/a>, and it seems that the issue that I was having in regards to the animation switching into the jump pose while standing on the corner was related to a couple of things.<\/p>\n<p>&nbsp;<\/p>\n<p>What I had <strong>should<\/strong> be working, except it seems that there must be some floating point precision issues going on. I was very careful to have my ground check (which was being done by using Physics2D.OverlapCircle() to check a radius around a given point for a ground surface) positioned and sized correctly, however it just <strong>wasn&#8217;t<\/strong> working. As best as I can tell there&#8217;s a floating point accuracy issue at fault here because turning Pixel Snap on or off made no difference however if I set my groundRadius to 0.0005 larger than it needs to be, the problem went away.<\/p>\n<p>&nbsp;<\/p>\n<p>Aside from that , it&#8217;s been suggested that I avoid using the OverlapCircle function and instead use a LineCast. I had briefly seen line-casts in use in one of the tutorials, last week however it was already set-up and didn&#8217;t require me to do any tinkering. What&#8217;s been recommended, is that I use line-casts for detecting different types of surfaces using layer masks. This will make it easier to a: detect edges, and b: detect slopes&#8230; apparently using Edge colliders is going to be better than Box colliders. This is the theory at least. I still need to test it.<\/p>\n<p>&nbsp;<\/p>\n<p>The line casting looks promising though as that&#8217;s what allowed Sonic to have different off-balance animations depending on how close he was to standing on an edge. Pair a multi-ray cast check with something to make sure that you&#8217;re actually standing still, and you should be able to have a nice set-up.<\/p>\n<p>&nbsp;<\/p>\n<p>The tutorials that I went with this week were the Sidescroller Platform videos from <a href=\"http:\/\/www.youtube.com\/user\/Cercopithecan\/videos\">Sebastian Lague&#8217;s YouTube channel<\/a>. These videos go a bit further than the stuff I did previously, and also makes use of 3D models and rigs rather than 2D and sprites.<\/p>\n<ul>\n<li>We are using ray casting this time around&#8230; however I&#8217;m going to have to tinker with it to get results similar to what I discussed above. The two main problems that it&#8217;s got at the moment is that I&#8217;m changing the size of the collisions depending on whether the character is sliding or standing &#8211; this results in bad collisions if the character stands up from a sliding position but has something above his head. The character also seems to be configured to better accept diagonal collisions, yet falls through slanted surfaces. That&#8217;s a puzzle to me. I&#8217;m going to have to find some info out there about colliding surfaces, unless I want to be stuck in 8-Bit platformer world forever.<\/li>\n<li>We also build our own physics rather than relying on Unity&#8217;s. I&#8217;m not really sure what the benefit is of this.<\/li>\n<li>We have the player instantiated by the camera. The series also includes a little about rag dolls, and killing characters so we&#8217;re generally passing information around between different things a lot more than in other tutorials I&#8217;ve followed.<\/li>\n<li>We have a model (from Blender) which is pre-animated and so we&#8217;re bringing it in and using the animation tools to blend between the different states. One thing that&#8217;s annoying about this is that I have no idea how to use Blender, and this is kind of glossed over&#8230; so I&#8217;m not quite sure how to set up the exports myself just yet. Unfortunately Sebastian updates the model\/rig a couple of times through the series, and by the time we get to discussing rag dolls, I&#8217;m not entirely sure how to get the rig switched so that it works. I had to just open his final file since I couldn&#8217;t get the new rig to work in my old file.<\/li>\n<li>We do learn how to have some animations blended together (the character&#8217;s headband animates at all times and is an animation that is masked in).<\/li>\n<li>We set up a death trigger which sends the character into the rag doll state<\/li>\n<li>We set up wall jump mechanics<\/li>\n<li>Finally, we create checkpoints and allow for the completion of levels.<\/li>\n<\/ul>\n<p>Sebastian finishes the 8th video by stating that there will be a 9th&#8230; but given that he&#8217;s moved on and started teaching other game mechanics, I suspect that&#8217;s going to be it for his sidescroller tutorials. They&#8217;re good, but also a little vague. They&#8217;re a little tougher to pick stuff up from than previous things I&#8217;ve done.<\/p>\n<p>&nbsp;<\/p>\n<p>I still have the same list of &#8220;to-do&#8221; tutorials as I had last week, however I&#8217;m also very interested in checking out the 2D Tool Kit from the asset store. It seems like it&#8217;s geared a little more specifically toward the type of stuff I want to start making than the new tools developed by Unity for 4.3.<\/p>\n<p>&nbsp;<\/p>\n<p>Egad there&#8217;s a lot to learn!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got up to learning more 2D platforming this week, though with a friend of 20+ years in town this week I&#8217;ve ended up doing far more touristy stuff this week than bi&#8217;ness. Actually, 2D platforming is a slight misnomer, as the stuff that I was working with this week was actually 3D. &nbsp;<\/p>\n","protected":false},"author":3,"featured_media":2284,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[13],"class_list":["post-2283","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-progress-report"],"_links":{"self":[{"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=\/wp\/v2\/posts\/2283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2283"}],"version-history":[{"count":2,"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=\/wp\/v2\/posts\/2283\/revisions"}],"predecessor-version":[{"id":2286,"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=\/wp\/v2\/posts\/2283\/revisions\/2286"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=\/wp\/v2\/media\/2284"}],"wp:attachment":[{"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2283"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sprixelsoft.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}