<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Unity3D &#8211; INCD021</title>
	<atom:link href="https://incd021.com/tag/unity3d/feed/" rel="self" type="application/rss+xml" />
	<link>https://incd021.com</link>
	<description>Programming, thoughts, life  and art.</description>
	<lastBuildDate>Fri, 07 Jun 2013 15:32:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>Player movement script for the 3&#215;3 POC</title>
		<link>https://incd021.com/2013/06/07/player-movement-script-for-the-3x3-poc/</link>
					<comments>https://incd021.com/2013/06/07/player-movement-script-for-the-3x3-poc/#comments</comments>
		
		<dc:creator><![CDATA[INC $D021]]></dc:creator>
		<pubDate>Fri, 07 Jun 2013 15:32:58 +0000</pubDate>
				<category><![CDATA[3x3]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[POC]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Unity Script]]></category>
		<category><![CDATA[Unity3D]]></category>
		<guid isPermaLink="false">http://incd021.com/?p=277</guid>

					<description><![CDATA[I just wanted to show how I chose to do the player control script. After playing the game some more, I&#8217;ve decided that the game isn&#8217;t going to work on....]]></description>
										<content:encoded><![CDATA[<p>I just wanted to show how I chose to do the player control script. After playing the game some more, I&#8217;ve decided that the game isn&#8217;t going to work on the mobile devises. The swipe to move the player would be very counter intuitive after level 8.</p>
<p>For the movement script, I wanted the player to move in a continuous motion and not in discreet jumps. The player should also be able to keep moving in one direction holding down a direction button.</p>
<p>To keep track of what the player is doing, I first made an enum with the possible motion states.<br />
I guess the enums are self explanatory <img src="https://s.w.org/images/core/emoji/15.1.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<pre class="brush: actionscript3; gutter: true">enum Moving
{
    NO,
    UP,
    DOWN,
    LEFT,
    RIGHT
};</pre>
<p>Now the the logic. If the player isn&#8217;t moving, check for player input.</p>
<pre class="brush: actionscript3; gutter: true">
        if (direction == Moving.NO)
        {
            if (Input.GetKey(KeyCode.A))
            {
                direction = Moving.LEFT;
            }
            if (Input.GetKey(KeyCode.D))
            {
                direction = Moving.RIGHT;
            }
            if (Input.GetKey(KeyCode.W))
            {
                direction = Moving.UP;
            }
            if (Input.GetKey(KeyCode.S))
            {
                direction = Moving.DOWN;
            }
        }</pre>
<p>Now if the player is moving, the enum will be holding the direction of motion and we can move the player.</p>
<pre class="brush: actionscript3; gutter: true">            switch (direction)
            {
                case Moving.UP:
                    if (moveLeft &gt; 0f)
                    {
                        Vector3 v3 = transform.position;
                        v3.y += movementSpeed;
                        moveLeft -= +movementSpeed;
                        if (v3.y &gt; 1f)
                        {
                            v3.y = 1f;
                            moveLeft = 1.0f;
                            direction = Moving.NO;
                        }
                        transform.position = v3;
                    }
                    else
                    {
                        moveLeft = 1.0f;
                        direction = Moving.NO;
                    }
                    break;
                case Moving.DOWN:
                    if (moveLeft &gt; 0f)
                    {
                        Vector3 v3 = transform.position;
                        v3.y -= movementSpeed;
                        moveLeft -= +movementSpeed;
                        if (v3.y &lt; -1f)
                        {
                            v3.y = -1f;
                            moveLeft = 1.0f;
                            direction = Moving.NO;
                        }
                        transform.position = v3;
                    }
                    else
                    {
                        moveLeft = 1.0f;
                        direction = Moving.NO;
                    }
                    break;
                case Moving.LEFT:
                    if (moveLeft &gt; 0f)
                    {
                        Vector3 v3 = transform.position;
                        v3.x -= movementSpeed;
                        moveLeft -= +movementSpeed;
                        if (v3.x &lt; -1f)
                        {
                            v3.x = -1f;
                            moveLeft = 1.0f;
                            direction = Moving.NO;
                        } transform.position = v3;
                    }

                    else
                    {
                        moveLeft = 1.0f;
                        direction = Moving.NO;
                    }
                    break;
                case Moving.RIGHT:
                    if (moveLeft &gt; 0f)
                    {
                        Vector3 v3 = transform.position;
                        v3.x += movementSpeed;
                        moveLeft -= +movementSpeed;
                        if (v3.x &gt; 1f)
                        {
                            v3.x = 1f;
                            moveLeft = 1.0f;
                            direction = Moving.NO;
                        }
                        transform.position = v3;
                    }
                    else
                    {
                        moveLeft = 1.0f;
                        direction = Moving.NO;
                    }
                    break;
                default:
                    break;
            }</pre>
<p>That&#8217;s it, not pretty but it works. If I have the time, I would like to make the motion even more fluent. The state change if you keep a key down makes the player give a little jump/jitter as the state goes through NO state before returning to a moving state. But for now it gets the job done <img src="https://s.w.org/images/core/emoji/15.1.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>All feedback is welcome, I can&#8217;t change if I don&#8217;t know what to change. <img src="https://s.w.org/images/core/emoji/15.1.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>&#8211; Henning</p>
]]></content:encoded>
					
					<wfw:commentRss>https://incd021.com/2013/06/07/player-movement-script-for-the-3x3-poc/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>3×3 POC version 4</title>
		<link>https://incd021.com/2013/06/06/3x3-poc-version-4/</link>
					<comments>https://incd021.com/2013/06/06/3x3-poc-version-4/#respond</comments>
		
		<dc:creator><![CDATA[INC $D021]]></dc:creator>
		<pubDate>Thu, 06 Jun 2013 06:01:25 +0000</pubDate>
				<category><![CDATA[3x3]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Proof of concept]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[Indie Game]]></category>
		<category><![CDATA[POC]]></category>
		<category><![CDATA[Unity3D]]></category>
		<guid isPermaLink="false">http://incd021.com/?p=265</guid>

					<description><![CDATA[The POC is really starting to look like a game. 🙂 New things added: New texture. I only use one for all surfaces. Rotation to selected box, to make it....]]></description>
										<content:encoded><![CDATA[<p>The POC is really starting to look like a game. <img src="https://s.w.org/images/core/emoji/15.1.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>New things added:</p>
<ul>
<li><span style="line-height: 1.5;">New texture. I only use one for all surfaces.</span></li>
<li><span style="line-height: 1.5;">Rotation to selected box, to make it visible to the player what box is selected.</span></li>
<li><span style="line-height: 1.5;">More states to the box objects, to make possible removal animation aso.</span></li>
<li><span style="line-height: 1.5;">Color click logic, basic game mechanics .</span></li>
</ul>
<figure id="attachment_266" aria-describedby="caption-attachment-266" style="width: 300px" class="wp-caption aligncenter"><a href="https://incd021.com/wp-content/uploads/2013/06/3x3v004.png"><img fetchpriority="high" decoding="async" class="size-medium wp-image-266" alt="3x3 POC version 4" src="https://incd021.com/wp-content/uploads/2013/06/3x3v004-300x187.png" width="300" height="187" /></a><figcaption id="caption-attachment-266" class="wp-caption-text">3&#215;3 POC version 4</figcaption></figure>
<p>The plan is to make the game run on my old HTC Desire, to learn the mobile part of unity. So for now I&#8217;m trying to keep everything to a minimum as not to drive the Desire to it&#8217;s knees.</p>
<p>Next things to add:</p>
<ul>
<li><span style="line-height: 1.5;">Mobile input part, to see if I can&#8217;t get the click and swipe part to work.</span></li>
<li><span style="line-height: 1.5;">Light bound to the box, to illuminate the boxes in the distance, and I might remove the current spotlight..</span></li>
</ul>
<p>&nbsp;</p>
<p><span style="line-height: 1.5;">Future things to add:</span></p>
<ul>
<li><span style="line-height: 1.5;">Sound effects.</span></li>
<li><span style="line-height: 1.5;">Music.</span></li>
<li>Score system. How fast you remove boxes, or something like that, have to think about a good way to differentiate different users abilities.</li>
</ul>
<p>&nbsp;</p>
<p>Here you can play <a href="https://incd021.com/Games_POC/3x3v004.html">version 4</a>, and as before, click to remove blocks and navigate using wasd.</p>
<p>&#8211; Henning</p>
]]></content:encoded>
					
					<wfw:commentRss>https://incd021.com/2013/06/06/3x3-poc-version-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Procedural Mesh Generation in Unity.</title>
		<link>https://incd021.com/2013/05/04/procedural-mesh-generation-in-unity/</link>
					<comments>https://incd021.com/2013/05/04/procedural-mesh-generation-in-unity/#respond</comments>
		
		<dc:creator><![CDATA[INC $D021]]></dc:creator>
		<pubDate>Sat, 04 May 2013 09:56:03 +0000</pubDate>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[Mesh]]></category>
		<category><![CDATA[Mesh generation]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[Unity3D]]></category>
		<guid isPermaLink="false">http://incd021.com/?p=222</guid>

					<description><![CDATA[Mesh Generation in Unity I come from the good old OpenGL way of doing things and like the control I had with the simple geometry, so when I stumped upon....]]></description>
										<content:encoded><![CDATA[<h1>Mesh Generation in Unity</h1>
<p>I come from the good old OpenGL way of doing things and like the control I had with the simple geometry, so when I stumped upon gMaN Ji&#8217;s youtube video &#8220;<a href="http://www.youtube.com/watch?v=3jHe1FzrKD8">Unity Tips and Tricks: Procedural Geometry #1 &#8211; Basic Quad</a>&#8221; I had to make a small test to see how fast and easy it would be to do.</p>
<p>So hers what I got playing around a while:</p>
<p>http://youtu.be/iNhJNUgRUIU</p>
<p>It&#8217;s was made with 25&#215;25 meshes with part of the full texture mapped to each mesh, and then I just added some random rotation to them. Didn&#8217;t want to spend a lot of time making the rotations look good, as it&#8217;s just a test. But the possibilities made possible by having this amount of control are limitless <img src="https://s.w.org/images/core/emoji/15.1.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>&#8211; Henning</p>
]]></content:encoded>
					
					<wfw:commentRss>https://incd021.com/2013/05/04/procedural-mesh-generation-in-unity/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Page Caching using Disk: Enhanced 

Served from: incd021.com @ 2025-05-17 23:00:57 by W3 Total Cache
-->