<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gabriel Perez on Medium]]></title>
        <description><![CDATA[Stories by Gabriel Perez on Medium]]></description>
        <link>https://medium.com/@sleepingdaemon?source=rss-32c3d075e286------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Sv784o0LDzf18fWHXo81Tg.png</url>
            <title>Stories by Gabriel Perez on Medium</title>
            <link>https://medium.com/@sleepingdaemon?source=rss-32c3d075e286------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 04:11:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sleepingdaemon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Unity Scene: Control Room 2]]></title>
            <link>https://sleepingdaemon.medium.com/unity-scene-control-room-2-a16526e05635?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/a16526e05635</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[level-design]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Mon, 02 Oct 2023 16:02:57 GMT</pubDate>
            <atom:updated>2023-10-02T16:36:48.964Z</atom:updated>
            <content:encoded><![CDATA[<p>The progress of a scene I created using Unity’s HDRP pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*p6ip9YPjj2BhTlProbN8Qw.gif" /></figure><p>Hey everyone, it’s been a while since I last continued my studies over at GameDevHQ! I&#39;ve decided to review a few courses and refine my knowledge.</p><h4>Why am I remaking Control Room 2?</h4><p>I created my first Control Room scene when I started the “A Guide to Beautiful Games in Unity” course from GameDevHQ. Below, you can see a video I put together of the scene:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FmbhvwntW0vE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmbhvwntW0vE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FmbhvwntW0vE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/042506859c55c43e820e980a7bb0cb5a/href">https://medium.com/media/042506859c55c43e820e980a7bb0cb5a/href</a></iframe><p>It has been roughly a year and a half since finishing the scene. I also feel the need to brush up on things I need to remember!</p><p>So why not retake the course?</p><h4>Different and Bigger</h4><p>This time around, I challenged myself by thinking bigger. I also kept in mind about using the scene for future projects. For instance, I’ll be able to mess around with the cameras on the scene for my next course “Timeline and Cinemachine.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mfD1GiGnuzzSqLNQcN1OCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMj55RDsMG9-2qzwagN6sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8BjX9OFqRL6IGewjDUmOIg.png" /><figcaption>The start of it all. I used various unity assets from Filebase, Scifi Base, and Industrial Zone.</figcaption></figure><p>The previous control room had an importance on the mechs and on this version, I gave the importance to the middle area on the bottom and top floor. It’s more evident at the final of the scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*OUhqYrRUiAPuqLZ_bWZkfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8HWXsLlG3kttCySOqIS__g.png" /></figure><p>While laying out the scene, I also played with the post-processing effects and lighting. At first, I wanted the scene to cast sun rays on the mechs. Instead, I chose a night scene where the indoor lighting took charge to light up the areas dramatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*hZsTxiWwjRe-wNndqQZypA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*Ciac5x0IoP8L0PKGy42EfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*PalCyGJqmQywaJ766d8ldg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*XSSpkLm0ZVp0Zo7F9iivGQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*724WNk5UXrWJJhg3zE0-WQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qkaXxgZcJvavukmO4lwE4w.png" /></figure><h4>Storytelling</h4><p>Sometime throughout the beginning of adding details, I had the idea of creating a large elevator in the middle of the scene. Honestly, the idea came from not knowing what to do with the bottom floor middle space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*idfOrumGIbM6yXBtt0St1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rU1LszX1r3jZchVMggGxJg.png" /></figure><p>With this idea in mind, I created a separate game object and started adding prefabs for the elevator, knowing that at some point, I would animate it.</p><p>I thought to myself about many story ideas to connect the reason for the design choices I made on the scene. The elevator, in this case, serves as the main area to bring materials, parts, etc. logistically up to the control room. With these ideas, I would think that the control room is somewhere high. Perhaps ontop of a mountain!?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ecKhLvXuGOXicdyCVbL-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EIcs4Z-4LqxNwWdQNtV0Gg.png" /></figure><p>For the main hallway, I wanted it to be dark, creepy, and mechanical, so I added pipes, wires, minimal lighting, and a catwalk. It’s not the main focal point of the scene but I still had to make it aesthetically pleasing! The wires alone adds a sense of living to the space. It’s not entirely telling a story but it does give that extra element of visual story telling.</p><h4>Finalizing the Scene</h4><p>After adding all the details in place, I took the time to get the lighting and post-processing to a point of acceptance. I also added agents walking around to add a sense of liveliness. Finally, I animated and scripted the elevator coming up from the middle, with a red light spinning around. When the animation completes, the script turns off the red light.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W27ntlt5FJF43VOkx25Z-Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qsWvO8qx4U9vgpgVftWnQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpWKuQZCg6UUD41JTIKokw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SzE2ttevqPhr4N9B_HcqDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4TZT4tn-LkowVR5NJA_Zug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hlJmwrcdz2PwVlwTXDuCFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EdexqYEIFwMC5-HYU4W9BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNrXaJ1rX1KUiJMvNU0evA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2ysZrySAfg_AdBnN9opBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yOV_bcI9SsY1-HutX_n3HQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o53AzKFJR7IwTh2VgP_AMQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IKpAyk1ZvOliSHQ1IiGh8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RSXWgd1Al5uAjIF3iQLgTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4nQz_Ch80uz6NycYVtxpiw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zv3_5gNyqIIFshubr1vZzA.png" /></figure><h4>Final Thoughts</h4><p>Some challenges came about. Lighting and shadows are one of them, but after adjusting different settings, I got it to a point that I am happy with. Also, it was the first time I used the LOD Group system in most of the prefabs. So it posed some annoying instances of models switching to a lower/higher poly count when the camera was at a certain distance. I had to adjust each prefab once I found out the problem, but it was definitely a learning experience!</p><p>I’ll be releasing a walkthrough montage of the scene soon. I’ll make sure to post about it when I do! Thanks for passing by!</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a16526e05635" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting an Interactive Security Camera System]]></title>
            <link>https://sleepingdaemon.medium.com/setting-an-interactive-security-camera-system-4d6a0a4ab309?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d6a0a4ab309</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[gamedev]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Sun, 25 Sep 2022 11:25:26 GMT</pubDate>
            <atom:updated>2022-09-25T11:25:26.282Z</atom:updated>
            <content:encoded><![CDATA[<p>Using Cinemachine, we can create different camera events when needed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*FtStVd0rpYheqg4U2hv7NA.gif" /></figure><h3>Objective</h3><p>The idea is to have the player enter a trigger that will allow the switching of multiple virtual machine cameras set in position around the environment with a touch of a button.</p><h3>Camera Setup</h3><p>I set four virtual cameras around the room, looking in all directions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*3zQCbdBzObN4v-3iRPF3wA.gif" /><figcaption>Stationary Camera 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*ub3T_y1ztoi2Ik3OpFZ-cw.gif" /><figcaption>POV Camera</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*BnuvHoN_AMvg-mGnJG6rNw.gif" /><figcaption>Blend Camera</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*g2E14ER3V_YBIP3MgmMsyA.gif" /><figcaption>Stationary Camera 2</figcaption></figure><p>With my cams in place, I need a way for the player to trigger and enable the ability to cycle the security cams.</p><h3>Trigger</h3><p>I set a trigger collider in the middle of the room.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwHic7bofXxGjhb58Qev5Q.png" /></figure><p>It will allow me to attach a script to the trigger collider so that it can detect the player.</p><h3>Script</h3><p>I want to access all of my security cams by caching them to an array.</p><p>[SerializeField] private CinemachineVirtualCameraBase[] _cams;</p><p>I also want to increment the index of the array every time I press the button to cycle through the cameras. So I set an integer variable to keep track of the value.</p><p>private int index = 0;</p><p>I also want to add a boolean so that when the player enters the trigger, I can set the bool to true to enable the cycling of the cameras.</p><p>private bool _canCycleCams;</p><p>Since I want this trigger collider to detect the player, I want to use the OnTriggerEnter() method that Unity provides.</p><pre>private void OnTriggerEnter(Collider other)<br>{<br>   if (other.CompareTag(“Player”))<br>   {<br>      _canCycleCams = true;<br>   }<br>}</pre><p>If what I (the trigger collider) detected is the player, then set the bool to true. When true, the player can use the input system to cycle through the cameras.</p><p>Next, I want to set the current camera to a higher priority. It will allow any camera with the current index to have priority over the others. If the current index value is 1, the camera’s priority at index level 1 will be a higher value.</p><pre>private void SetCurrentCamera()<br>{<br>   if (_cams[index])<br>   _cams[index].Priority = 100;<br>}</pre><p>If we are on this camera, set the priority of the camera to 100. The magic number 100 can be anything. As long as it’s higher than the default priority value.</p><p>Next, I want to set back the priority of all cameras to 10. It will allow for the current camera to always be active when switching cameras.</p><pre>private void SetLowPriority()<br>{<br>   for (int i = 0; i &lt; _cams.Length; i++)<br>   {<br>      if (_cams[i])<br>         _cams[i].Priority = 10;<br>   }<br>}</pre><p>I want to loop through each camera and set its priority to 10.</p><p>Next, I want to press the y button to cycle through each camera in the Update method.</p><pre>if (Input.GetKeyDown(KeyCode.Y) &amp;&amp; _canCycleCams)<br>{<br>   index++;</pre><pre>   if (index &gt; _cams.Length — 1)<br>   {<br>      index = 1;<br>   }</pre><pre>   SetLowPriority();<br>   SetCurrentCamera();<br>}</pre><p>If I press the ‘Y’ button and I can cycle through the cameras, I want to increment the index. I also want to check if the index is greater than the total number of cameras. If so, I set the index to 1. It will switch my cameras back to the first. Index 0 is the default player camera.</p><p>I also want to set the lowest priority and the current camera methods to update the cameras.</p><p>Lastly, I want the default player camera to be active when the player leaves the trigger collider.</p><pre>private void OnTriggerExit(Collider other)<br> {<br> _canCycleCams = false;<br> index = 0;<br> SetLowPriority();<br> SetCurrentCamera();<br> }</pre><p>When the player exits the trigger, set the bool to false. If left to true, we can cycle through the cameras anywhere outside of the trigger.</p><p>I also set the index to 0, the default player camera. I call in the SetLowPriority() method to reset all the cameras. Then I call in the SetCurrrentCamera() method to update the camera back to the stored value in the index.</p><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*CGUKV7RNOBxnzQYyCNBMEA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*OJ0P7byh2b42VdAEggxMow.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*gZ9d60vtGYYVIgu5bSgT9Q.gif" /></figure><p>That is all for today! Thank you for your time.</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d6a0a4ab309" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding State-Driven Cameras for your Animation States.]]></title>
            <link>https://sleepingdaemon.medium.com/adding-state-driven-cameras-for-your-animation-states-6c1d0306d8f7?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c1d0306d8f7</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[cinemachine]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Sun, 11 Sep 2022 09:51:34 GMT</pubDate>
            <atom:updated>2022-09-11T09:51:34.855Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*KhBsMXmSqXRmCUpYFuQqNw.gif" /></figure><p>Cinemachine has a built-in virtual camera for state-driven animations, which makes our lives, as Unity Developers, easier!</p><p>On to the demonstration, I have four states I would like to switch cameras to:</p><ul><li>Idle</li><li>Running</li><li>Aiming</li><li>Player Death</li></ul><p>I created four Virtual Cameras for each state and set them up to my liking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*ldFxYCnuyT6fB1b6mHEItw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*-oLPEMcSwwTd4LCSEWmrRw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*ZdFzV0Jv_r3_PNtR3mpdYw.gif" /></figure><p>Next, I added a “State-driven” camera and placed the four virtual cameras inside of the state-driven game object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/213/1*P0yfT26rekzvicW0R9dppg.png" /></figure><p>I will go through the over-the-shoulder camera setup for my aiming animation state next.</p><h4>Over-the-Shoulder (for aiming) Virtual Camera</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*FLHondFlmVuv8765HMiuXw.gif" /></figure><p>I created a new virtual camera and called it “CM 3rd Person Aim.” I set the body mode to “3rd Person Follow” so that the camera stays behind the player. For the aim mode, I set it to “Same as Follow Target.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*VEfnCLjQkyPZskypq7_AZQ.png" /></figure><p>I experimented with the Rig settings under the body to have that “Over-the-Shoulder” view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*yigwht14gGLcXb1q0WLFsQ.gif" /></figure><p>The image above represents the position of the aiming state camera with a noise effect to imitate a hand-held camera.</p><h4>State-Driven Camera</h4><p>With all of my Virtual Cameras set, I put them inside of a State-Driven Camera game object. The way this camera works is that it gets the information from your animation states in the Animator window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*KMIBF6DXqY-ZsoNgqQQcsQ.png" /></figure><p>In my Animator window, I set my animation states to being:</p><ul><li>Dead</li><li>Grounded</li><li>Airborne</li><li>Crouching</li><li>Aiming</li></ul><p>In the state-driven camera settings, I set the Follow Target to my player game object. The Look At is not mandatory since the Aim Mode to all my camera’s set to “Same as Follow Target.”</p><p>I also attached the Animator component of the player to the Animated Target. This will give the camera the information it needs to access the animation states.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*HzwS7wQtadSOllnrv5-R0Q.png" /></figure><p>For the State and Camera properties, I assigned the proper state to each camera. This is where the magic of this camera revolves around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*3ex4mAPhDT0Y3R8ExO4xOw.gif" /></figure><p>With everything in place, we now have a functional 3rd person camera system with no programming involved!</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c1d0306d8f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cinemachine: Security Camera using Blend List Camera]]></title>
            <link>https://sleepingdaemon.medium.com/cinemachine-security-camera-using-blend-list-camera-5943961a0aba?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/5943961a0aba</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Sat, 26 Mar 2022 11:24:35 GMT</pubDate>
            <atom:updated>2022-03-26T11:24:35.893Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*Xm7xOcDShffWUnrH_eU1Uw.gif" /></figure><h3>Blend List Camera</h3><p>The blend list camera executes a sequence of blends or cuts among its child Virtual Cameras. It’s great for creating montages and security cameras!</p><p>Down below is an example of a montage, recorded directly in Unity, using many Blend List cameras.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-9es67LPbYs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-9es67LPbYs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-9es67LPbYs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4a5e91e16a6713c283cd49b361c6c72/href">https://medium.com/media/e4a5e91e16a6713c283cd49b361c6c72/href</a></iframe><h3>Security Camera Setup</h3><p>Creating a Blend List Camera automatically creates a game object with two child virtual cameras.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/235/1*QzhQ8JisNur7CTs-EQ6_Iw.png" /></figure><p>I positioned the child cameras high on a corner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*QxY4vCz5BWEwHnkT3JI8hA.png" /><figcaption>The position of both of the cameras.</figcaption></figure><p>I rotated the angle of the first camera toward the left wall and the second camera toward the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*N1GndeUunt0N3JLaRhLDlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*qht9L-qRafNnDZw9S39aPg.png" /></figure><h3>Blend List Camera Settings</h3><p>I want the camera to loop back and forth from the first to the second and vice versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*SJh56VoQz3oSEdIbNPrFPw.png" /></figure><p>I make sure that I check the Loop property. The first child camera will reveal the option to Blend in. I want to ease in and out for both cameras. It will simulate how a security camera functions. I set both a value of 5 seconds to complete its blending from one camera to the other. I also set a value of 1 to both of the camera’s Hold properties to hold one second after its blend completion.</p><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*giJRlQ9ZobiqLx07H98Oiw.gif" /><figcaption>A Blend List Camera without a volume stack.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*Xm7xOcDShffWUnrH_eU1Uw.gif" /><figcaption>A Blend List Camera with a volume stack.</figcaption></figure><p>The final result mimics that of a security camera! Very easy and powerful. Playing around with more cameras with different Blend In settings can result in different ways of displaying security cameras through an interaction system.</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5943961a0aba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cinemachine: A Look into the “FreeLook” Camera]]></title>
            <link>https://sleepingdaemon.medium.com/cinemachine-a-look-into-the-freelook-camera-3b2712d662a9?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b2712d662a9</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Fri, 25 Mar 2022 07:57:50 GMT</pubDate>
            <atom:updated>2022-03-25T07:57:50.993Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*IlEAn6Jj80NkoBmb-qh-Pw.gif" /></figure><h3>FreeLook Camera</h3><p>The FreeLook camera is a complete third-person camera solution! This virtual camera orbits around a target’s position specified by three separate camera rigs: Top, Middle, and Bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dzltjplcOKyLjGVf1b0Drw.png" /></figure><p>The best part of this camera is its use of simplicity of user input. It automatically handles input without any code once activated.</p><h3>FreeLook Camera Settings</h3><p>The freelook camera is the orbital algorithm on steroids. Instead of the look movement being restricted to the x-axis, we now have settings for the y and z-axis with several new features.</p><h4>Axis Control</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*IfP99nE9E-rgNj2TF5OKtg.png" /></figure><p>Axis Control settings specify the vertical and horizontal axes for blending between rigs.</p><ul><li><strong>Value</strong>: A value range of 0 to 1 represents the blend position between the rigs. A value of 0.5 represents the middle rig.</li><li><strong>Max Speed</strong>: The maximum speed of an Axis.</li><li><strong>Speed Mode</strong>: How the axis responds to input.</li><li><strong>Accel Time</strong>: The amount of time in seconds to accelerate to Max Speed.</li><li><strong>Decel Time</strong>: The amount of time in seconds to decelerate to zero.</li><li><strong>Input Axis Name</strong>: The name of the axis as specified in Unity Input Manager.</li><li><strong>Input Axis Value</strong>: The value of the input axis.</li><li><strong>Invert</strong>: Check to invert the raw value of the input axis.</li></ul><h4>Y Axis Recentering</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*g62dN1yPhAEtNHjlgl1E0g.gif" /></figure><p>The Y Axis Recentering controls the automatic recentering of the camera.</p><ul><li><strong>Enabled</strong>: Check to enable automatic recentering.</li><li><strong>Wait Time</strong>: The amount of time it takes before detecting no input on either axis before recentering.</li><li><strong>Recentering Time</strong>: The speed in which it takes to recenter back into position.</li></ul><h4>Orbits</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*GRBANZPXE3ijD4mf6RK8EQ.png" /></figure><p>The Orbits settings are properties that define the top, middle and bottom rigs.</p><ul><li><strong>Binding Mode</strong>: The coordinate space to use to interpret the offset from the target.</li><li><strong>Spline Curvature</strong>: The curvature line in which the camera rigs orbit.</li><li><strong>Height and Radius</strong>: The radius and height of the top, middle, and bottom rigs relative to the Follow target.</li></ul><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*VMw-VBKlhv8beWzvp454Zg.gif" /></figure><p>The FreeLook camera provides an all in one 3rd Person Camera solution. It requires no code at all, just plug and play!</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b2712d662a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cinemachine: How to create Camera Shake on Unity Cameras]]></title>
            <link>https://sleepingdaemon.medium.com/cinemachine-how-to-create-camera-shake-on-unity-cameras-9bee154e924f?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bee154e924f</guid>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Thu, 17 Mar 2022 13:06:04 GMT</pubDate>
            <atom:updated>2022-03-17T13:06:04.685Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever wonder how to have a camera shake effect? It’s very simple!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*Ovjm9cYoWM0sq7yoyEEKcQ.gif" /></figure><h3>Camera Shake</h3><p>Let’s set up a new virtual camera in our scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*2_8-T8fWWRAs696iFdL76Q.gif" /></figure><p>I want to add a handheld effect to the shot above.</p><h4>Cinemachine Virtual Camera Component</h4><p>When creating a new virtual camera, we want to access the Cinemachine Virtual Camera component in the inspector tab. At the very bottom of the component, there is a dropdown menu for the “Noise” property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*BJZ8hFxqjxopY2liuz8vQg.gif" /></figure><p>Click on the dropdown and add “Basic Multi-Channel Perlin.” Cinemachine will add Perlin Noise to the movement of the camera.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*RtuvC2q3tcs98QTPH9qYtw.png" /></figure><p>We’ll have access to a set of new properties to play with.</p><h3>Noise Properties</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*oBZdcoLcDmG2OKOyeADUXQ.gif" /><figcaption>There are 8 camera shake profiles to use!</figcaption></figure><p>The noise properties will help simulate camera shake! Let&#39;s take a brief look at each property.</p><h4>Noise Profiles</h4><p>The noise profiles are assets that can be used for specific camera shakes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*iA505EUQ-ylpaAOsmUTnIQ.gif" /><figcaption>6D Shake could be used for tremors or an earthquake.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*8O6Yqb_RHlzStjml7Y8YMw.gif" /><figcaption>The Handheld profiles can be used to create that cameraman handheld feel.</figcaption></figure><h4>Amplitude Gain</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*Ee8xIGxiGHO341qt-UH9mg.gif" /><figcaption>A value of 3 shakes the camera faster.</figcaption></figure><p>The Gain to apply to the amplitudes defined in the noise profile. A larger value will shake the camera more rapidly. A value of 0 mutes the noise.</p><h4>Frequency Gain</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*WbM7-5OfovQ1S_ebGjOOJg.gif" /><figcaption>A value of 5 shakes the camera more intensely and faster.</figcaption></figure><p>The Factor to apply to the frequencies defined in the noise profile. A larger value will intensify the speed of the camera shake.</p><h4>Pivot Offset</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*GerJiQw8BSpnuHdMzUEz6w.gif" /><figcaption>With a pivot of x: 3, y: 4, and z: 4, we have a slight variation to the rotation.</figcaption></figure><p>When rotating the camera, the Pivot Offset will offset the camera’s pivot by the values of x, y, and z distance. This generates variation in the positioning to the rotation noise.</p><h3>Conclusion</h3><p>Cinemachine provides a simple way to add a camera shake for our needs! Now that we have an understanding of them, let&#39;s keep practicing by messing with other profiles and their properties and applying them to our games! The best way to trigger them would be to have trigger boxes on areas that would call the camera shake through code.</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bee154e924f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cinemachine: 3rd Person Follow, Orbital, and Transposer]]></title>
            <link>https://sleepingdaemon.medium.com/cinemachine-3rd-person-follow-orbital-and-transposer-4403f0dea4af?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/4403f0dea4af</guid>
            <category><![CDATA[game-design]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Wed, 16 Mar 2022 07:23:58 GMT</pubDate>
            <atom:updated>2022-03-16T07:23:58.743Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s have a look at three virtual camera algorithms!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*fVXNL1NTAN5vDxVI6DQ-4Q.gif" /></figure><h3>3rd Person Follow Algorithm</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*TzYKNHxQ6VFCOD59D2ArdA.png" /></figure><p>Just like a third-person view adventure game, we can set a virtual camera to do the same! The 3rd Person Follow Body Algorithm keeps the camera at a constant position and distance to the Follow target. It requires a Follow target to have the option to use the algorithm.</p><h3>3rd Person Follow Properties</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*xu-ulIC4Uen40qX9mkVqAg.png" /></figure><h4><strong>Damping</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*eQ7Ll0XdSOJetyFFVX5Bfg.gif" /><figcaption>With a value of 3 for the Z-axis, the camera slowly catches up to the Follow target when moving forward.</figcaption></figure><p>The responsiveness of the camera tracking the target. The input value is the time it takes for the camera to catch up to the target’s new position.</p><h4>Shoulder Offset</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*aakX6Nrf_dp1ObnnN4f-nw.gif" /><figcaption>We can shoulder offset the camera’s position by changing the X-Y-Z values.</figcaption></figure><p>The Shoulder Offset property positions the shoulder pivot to the Follow target.</p><h4>Vertical Arm Length</h4><p>The Vertical Arm Length property affects the Follow target’s screen position when the camera rotates vertically.</p><h4>Camera Side</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*n5RhjJyFsU0yXuyYS5aaFg.gif" /><figcaption>Sliding the Camera Side from 1 to 0. This could be programmed into a button to switch sides!</figcaption></figure><p>The Camera Side property specifies which shoulder the camera is on. When sliding from left to right, the shoulder camera will move to the right which is an exact copy of the opposite side but positive.</p><h4>Camera Distance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*zJUTqxz93rqQeTLE3v9Wrg.gif" /></figure><p>The Camera Distance property specifies the distance between the Follow target and the camera.</p><h4>Camera Collision Filter</h4><p>The Camera Collision Filter specifies which layers will be included or excluded for the camera to collide with.</p><h4>Ignore Tag</h4><p>The Ignore Tag property will ignore any tags checked. It is recommended to use the Follow target’s tag.</p><h4>Camera Radius</h4><p>The Camera Radius property specifies how close the camera can get to collidable obstacles without adjusting its position.</p><h3>Orbital Transposer Algorithm</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*t9hoK4TLyIdxSJH-wr61lg.gif" /></figure><p>This virtual camera Body algorithm moves the camera around the Follow target. It is recommended to use the Look At target with the Aim Composer algorithm. The algorithm also allows you to rotate around freely without any code!</p><h4>Orbital Transposer Properties</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*vDda_PJPbS0AlBtsCPCTYA.png" /></figure><h4>Binding Mode</h4><p>Choosing a binding mode property interprets the offset from the target. <a href="https://medium.com/@sleepingdaemon/cinemachine-unique-types-of-body-settings-in-virtual-cameras-49f721d59580">I wrote about Binding Mode and its modes here</a>.</p><h4>Follow Offset</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*GqlbRtzIquqqwHTNe1RUcA.gif" /></figure><p>The Follow Offset property gives the position offset to attempt to maintain from the Follow target.</p><h4>XYZ, Yaw, Pitch, Roll Damping</h4><p>The Damping properties specify how responsively the camera tries to maintain the offset of x, y, and z. A small value makes the camera more responsive. A large value more slowly. Depending on the Binding Mode, a couple of the properties will not show.</p><h4>Heading</h4><p>The Heading properties specify how to calculate the heading of the Follow target.</p><ul><li><strong>Definition</strong>: Choose <strong><em>Position Delta</em></strong> to calculate heading based on the difference in the position of the target from the last update and the current frame. Choose <strong><em>Velocity</em></strong> to use the velocity of the Rigidbody of the target. If the target does not have a rigidbody, reverts to Position Delta. Choose <strong><em>Target Forward</em></strong> to use the target’s local forward axis as the heading. Choose <strong><em>World Forward</em></strong> to use a constant world-space Forward as heading.</li><li><strong>Velocity Filter Strength</strong>: Controls the smoothing of the velocity when using Position Delta or Velocity in Definition.</li><li><strong>Bias</strong>: Angular offset in the orbit to place the camera, relative to the heading.</li></ul><h4>Recenter To Target Heading</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*vQ1jXxh72_d4ad20mAI9CQ.gif" /></figure><p>The Recenter To Target Heading controls the automatic recentering when there is no input. To enable, we must have <strong><em>Enabled</em></strong> checked. <strong><em>Wait Time</em></strong> is the seconds when the camera waits before recentering. <strong><em>Recentering Time</em></strong> is the maximum angular speed of recentering.</p><h4>X Axis</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*BIwhUPY0CX2jC5tjQ1U8qg.gif" /><figcaption>X Axis with a Min Value of -45 and a Max Value of 45.</figcaption></figure><p>The X Axis properties control the behavior of the camera in response to the player’s input.</p><ul><li><strong>Value</strong>: The current value of the axis, in degrees.</li><li><strong>Min Value</strong>: The minimum value for the axis.</li><li><strong>Max Value</strong>: The maximum value for the axis.</li><li><strong>Wrap</strong>: If checked, then the axis will wrap around at the Min and Max values, forming a loop.</li><li><strong>Max Speed</strong>: The maximum speed of this axis in degrees/second.</li><li><strong>Speed Mode</strong>: How the axis responds to input.</li><li><strong>Accel Time</strong>: The amount of time in seconds to accelerate to MaxSpeed.</li><li><strong>Decel Time</strong>: The amount of time in seconds to accelerate the axis to zero.</li><li>I<strong>nput Axis Name</strong>: The name of the axis as specified in the Unity Input Manager.</li><li><strong>Input Axis Value</strong>: The value of the input axis. A value of zero means no input.</li><li><strong>Invert</strong>: Check to invert the raw value of the input axis.</li></ul><h3>Transposer Algorithm</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*9lG2BIRTLMBKjSYLVZxmBA.png" /></figure><p>The Transposer algorithm moves the virtual camera in a fixed offset to the Follow target. It can be interpreted in various ways, depending on the Binding Mode.</p><h3>Transposer Binding Mode</h3><p>The Binding Modes are the coordinate space to use to Interpret the offset from the target. The Binding modes are all pretty much the same except for Simple Follow With World Up.</p><h4>Lock To Target On Assign</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*Z1M4oCrxUWj37QjnwnhQqA.gif" /></figure><p>The Lock To Target On Assign mode makes the orientation of the virtual camera match the local frame of the Follow target. The camera does not rotate along with the target.</p><h4>Lock To Target With World Up</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*xf1olJUW57fCOcBXjR1jpA.gif" /></figure><p>The Lock To Target With World Up makes the virtual camera use the local frame of the Follow target with tilt and roll set to zero. It ignores all target rotations except yaw.</p><h4>Lock To Target No Roll</h4><p>The Lock To Target No Roll mode makes the virtual camera use the local frame of the Follow target, with roll set to zero.</p><h4>Lock To Target</h4><p>The Lock To Target mode makes the virtual camera use the local frame of the Follow target. When the target rotates, the camera moves with it to maintain the offset and to maintain the same view of the target.</p><h4>World Space</h4><p>The World Space mode is interpreted in world space relative to the origin of the Follow target. The camera will not change position when the target rotates.</p><h4>Simple Follow With World Up</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*Xjz1PGME9alWw3ydCB_Ipw.gif" /></figure><p>The Simple Follow With World Up mode interprets the offset and damping values in camera-local space. The camera emulates the action a human camera operator would take when instructed to follow a target.</p><h3>Conclusion</h3><p>Now that we have an understanding of the 3rd Person Follow, Orbital, and Transposer algorithm properties, we can start applying them to our games! If you are making a 3rd person adventure game, look into using the 3rd Person Follow algorithm. Combined with Orbital, we have a better 3rd Person view system to look around the target’s surroundings. The Transposer algorithm I am not so sure. Any ideas?</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4403f0dea4af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cinemachine: Unique Types of Body Settings in Virtual Cameras]]></title>
            <link>https://sleepingdaemon.medium.com/cinemachine-unique-types-of-body-settings-in-virtual-cameras-49f721d59580?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/49f721d59580</guid>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[gamedevhq]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity3d]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Sat, 12 Mar 2022 09:46:22 GMT</pubDate>
            <atom:updated>2022-03-12T09:50:37.764Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s take a look into the unique type of Body settings in virtual Cameras!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*epR6rXwWdMss0X7DtEx-6A.gif" /></figure><h3>Body Algorithms</h3><p>There are six types of Body algorithms we can use in virtual cameras.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*ocA4peFVNLPElVkJN7mjfw.gif" /></figure><h4>Algorithms</h4><ul><li>3rd Person Follow</li><li>Framing Transposer</li><li>Hard Lock to Target</li><li>Orbital Transposer</li><li>Tracked Dolly</li><li>Transposer</li></ul><p>Each algorithm has its own set of properties. I’ll expand on this later.</p><h3>Binding Mode</h3><p>The binding mode has different selections when interpreting the offset from the target, and the damping. World Space coordinates will always be 0,0,0, which is ideal for a “Door Cam or Hood Cam” in a racing game.</p><h4>Types of Binding Modes</h4><p>The Body Algorithms “<strong>Transposer</strong>” and “<strong>Orbital Transposer</strong>” features Binding Modes.</p><ul><li><strong>Lock To Target on Assign</strong>: Uses the Follow target’s local frame at the moment that the Virtual Camera is activated or when the target is assigned.</li><li><strong>Lock To Target With World Up</strong>: Make the Virtual Camera use the Follow target’s local frame with tilt and roll set to 0. This binding mode ignores all target rotations except yaw (the Y-axis). It is best used when the Look At target is the same as the Follow target.</li><li><strong>Lock To Target No Roll</strong>: use the Follow target’s local frame, with roll set to 0 (Z-axis).</li><li><strong>Lock To Target:</strong> use the Follow target’s local frame with pitch, roll, and yaw in mind.</li><li><strong>World Space:</strong> The offset in world space relative to the Follow Target’s origin. The camera will not change position when the target rotates.</li><li><strong>Simple Follow With World Up</strong>: Interpret the offset and damping values in camera-local space. This mode emulates what a cameraman would do when following a target.</li></ul><h3>Binding Mode Examples</h3><p>The follow and Look At property has a target to follow and aim. Down below you can see two examples from each mode and different targets, the drone, and the project manager. What you will notice is that many binding modes act quite similarly, besides the “Simple Follow With World Up” mode.</p><h4>Lock To Target on Assign</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*7gdZxpVVtqNMcdTXFJlkbA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*mO41gZvCQMkw7gVxKKvY2Q.gif" /></figure><h4>Lock To Target With World Up</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*eT5y2cTlfAGE2DrYsxJFqQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*WTr4qwKtWNGHbsjvTzf0Gw.gif" /></figure><h4><strong>Lock To Target No Roll</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*sxzL0kA1MQcbZ7_jPMFmRg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*wIVoYXqY7ql94cM4UYJ3ag.gif" /></figure><h4>Lock To Target</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*NKew7a4jxRYs89mXP4TXHg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*8MVPt8_8gtiCsYQDAXTUtA.gif" /></figure><h4>World Space</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*NJL8fEP-QIv85-1e7Pm3LQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*8V1ztQz6-4prJ82ZUkNIaw.gif" /></figure><h4>Simple Follow With World Up</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*gEaWK4T733zBHc8BHd1pzA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*tG7p1DtmpabINnq4_XzF6Q.gif" /></figure><h3>Body Algorithms</h3><p>The Body Algorithm moves the Virtual Camera in the scene when a Follow target is active. Each Body Algorithm is unique for specific movements. Let’s have a brief look at the algorithms.</p><h4>3rd Person Follow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*0cTq9VvcOtyU8-nRF5LYCw.gif" /></figure><p>Pivots the camera horizontally and vertically while keeping a constant position and distance relative to the Follow target.</p><h4>Framing Transposer</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*1CLdr9GkpTOcfATV2FvqvQ.gif" /></figure><p>The Framing Transposer moves in a fixed position with the Follow target. It is best used for side-scroller games.</p><h4>Hard Lock To Target</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*l6qkogTG0-yOw2sgdpWMyA.gif" /></figure><p>The Hard Lock To Target algorithm uses the same position as the Follow target. It is great for a mounting point of a moving target such as a hood of a car.</p><h4>Orbital Transposer</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*h2ipEM3hJ3Crr54XO0MrSA.gif" /></figure><p>The Orbital Transposer rotates around the Follow and Look At target. The algorithm must have a Look At target to rotate around. It allows you to rotate freely or constrain around the target without code!</p><h4>Tracked Dolly</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*epR6rXwWdMss0X7DtEx-6A.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*Oq9fxA-7ofmPvgqPlZ6cjg.gif" /></figure><p>The Tracked Dolly algorithm tracks and moves along a path. We need to create a game object with a Cinemachine Path component for the setup of the track. It is great for showing environments through a set of waypoints.</p><h4>Transposer</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*p6N3uHE2gJDqfpI-fRe5QA.gif" /></figure><p>The Transposer algorithm moves in a fixed relationship to the Follow target.</p><h3>Conclusion</h3><p>Now that we have an idea for each Binding Mode and Body algorithm, we can experiment messing with the properties of each type! I will go in-depth about some of the algorithms in my next medium post.</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49f721d59580" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cinemachine: Look At and Body]]></title>
            <link>https://sleepingdaemon.medium.com/cinemachine-look-at-and-body-36a758969ef6?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/36a758969ef6</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Thu, 10 Mar 2022 10:27:56 GMT</pubDate>
            <atom:updated>2022-03-10T17:57:23.720Z</atom:updated>
            <content:encoded><![CDATA[<p>What are Look At and Body in Cinemachine? Let&#39;s take a look!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*1pxCfpv-j8v2Mg42UauKcQ.gif" /></figure><h3>Look At</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*VPjqogNKYQl0KYrsgheBQg.png" /></figure><p>The “Look At” is the aim target (game object) to look at. The Aim properties in the Virtual Camera use the Look At target for its properties. The Aim properties control the rotation of the Look At target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*y_7SXfFSMikkNwQIO42GmQ.gif" /><figcaption>Look At and Follow target using the Body’s 3rd Person Target algorithm.</figcaption></figure><h3>Body</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*_mP0csJklBAWTwer9jYEVA.png" /></figure><p>The Body of a virtual camera has properties to control the Follow target. Unlike Aim, which controls the rotation of the camera, the Body controls the position of the camera.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*DUwuiLFlYciqHxNl5K81Rg.gif" /><figcaption>Follow Target using the Body’s Composer algorithm.</figcaption></figure><h3>Combining Look At and Body</h3><p>Combining them is ideal for different types of shots. If you want to track a moving character, we can use the Body’s Dolly Track algorithm and set a path in the environment. The Camera will move along the path following the movement of the character while looking at the target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*h2hHn4Wi0-2vAjhcJSh5ng.gif" /><figcaption>Dolly Track set-up in the Scene View.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*CTuOzWLzvJMwCohROeCbdA.gif" /><figcaption>The Body’s Dolly Track Algorithm in the Game View.</figcaption></figure><p>In my next medium post, I will go through the Body’s unique type of settings! Stay tuned!</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36a758969ef6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cinemachine: Interactive Cameras using C#]]></title>
            <link>https://sleepingdaemon.medium.com/cinemachine-interactive-cameras-using-c-86a672ed21a6?source=rss-32c3d075e286------2</link>
            <guid isPermaLink="false">https://medium.com/p/86a672ed21a6</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <dc:creator><![CDATA[Gabriel Perez]]></dc:creator>
            <pubDate>Tue, 08 Mar 2022 15:43:01 GMT</pubDate>
            <atom:updated>2022-03-08T22:03:16.263Z</atom:updated>
            <content:encoded><![CDATA[<p>Switch and zoom in on targets using C#!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*0UsRD7M41b09YuObM-9sKg.gif" /></figure><h3>Objective</h3><p>Set up a virtual camera so it can track two targets by pressing the ‘R’ key. When pressing the “Space” key, decrement the Field of View from 60, 40, and 20. Reset the Field of View to 60 when less than 20.</p><h3>Targets</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*NQ9LDv3kVy-yOBpvb6j2zQ.png" /><figcaption>Lil Warbot Drone</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*z0SzIjayMy_F4SMzBo5JgQ.png" /><figcaption>Project Manager</figcaption></figure><h3>Setting up a Virtual Camera</h3><p>I create a new Virtual Camera and call it “VC1.” I change some of the properties:</p><ul><li>Look At: Lil Warbot Drone (transform of the game object)</li><li>Field of View: 60</li><li>Far Clip Plane: 50</li><li>Lookahead Time: 0.25f</li><li>Lookahead Smoothing: 5.6f</li><li>Horizontal and Vertical Damping: 1.5f</li><li>Dead Zone Width: 0.17f</li><li>Dead Zone Height: 0.12f</li><li>Soft Zone Width and Height: 0.8f</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*xyKatrtZGqYmhmMQ4JoL1A.png" /><figcaption>Game Window Guides help visualize the changes of each property.</figcaption></figure><p>I tested out the changes on both targets, and I like how it feels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*ma7sOCFd3vBmB-gHSGe_7A.gif" /><figcaption>Tracking Lil Warbot</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*lSdC0I1TRGV4-KZVeg6E0A.gif" /><figcaption>Tracking Project Manager</figcaption></figure><h3>Scripting</h3><p>Next, I create a new script and call it “CameraSwitch.” I attach it to the Virtual Camera.</p><p>Since we will be dealing with Cinemachine, I need to make sure I add the namespace Cinemachine.</p><p>using Cinemachine;</p><p>I need to reference each target with a serialized field.</p><pre>[SerializeField] private GameObject _target1, _target2;</pre><p>Now I can drag and drop each target in the inspector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*oN8YoR2equS0vXl26k_Htw.png" /></figure><p>Next, I need to hold a reference to the Virtual Camera and its Composer.</p><pre>private CinemachineVirtualCamera _vcam1;<br>private CinemachineComposer _vcam1Comp;</pre><p>Vcam1 variable will hold a reference for the Cinemachine Virtual Camera component. Vcam1Comp will hold a reference to the “Look At” target Aim settings. When I switch target to the Project Manager, I need to make sure the ‘Y’ position of the “Tracked Object Offset” is slightly higher around the chest/neck area for proper tracking.</p><p>Next, I create a bool to manage the logic to switch targets.</p><pre>private bool _switch = false;</pre><p>The last member variable will be a Vector 3 to hold a reference to the offset needed when switching between cameras.</p><h4>Storing Reference</h4><p>In the Start function, I need to hold references to some of the variables I created.</p><pre><strong>private void Start()<br>{<br>   _vcam1 = GetComponent&lt;CinemachineVirtualCamera&gt;();<br>   _vcam1Comp = _vcam1.GetCinemachineComponent&lt;CinemachineComposer&gt;();<br>   offset = _vcam1Comp.m_TrackedObjectOffset;<br>}</strong></pre><p>Vcam1 holds a reference to the Cinemachine Virtual Camera component on the game object when we created the Virtual Camera. It is where the script is attached to, so we need access to its component by storing it into a variable.</p><p>Vcam1Comp holds a reference to Vcam1’s Composer algorithm properties. We need to access the “Tracked Object Offset” to change the ‘Y’ position when the camera targets the Project Manager.</p><p>The offset variable will hold a reference to the Tracked Object Offset property.</p><h4>Switching Targets</h4><p>I create a new method called “Switch Target.” It will handle the logic behind switching targets.</p><pre><strong>private void SwitchTarget()<br>{<br>   _switch = !_switch;<br>}</strong></pre><p>I want to set a bool to toggle on and off when switching targets.</p><pre>private void SwitchTarget()<br>{<br>   _switch = !_switch;</pre><pre><strong>   switch (_switch)<br>   {<br>      case false:<br>         _vcam1.LookAt = _target1.transform;<br>         offset = new Vector3(0, 0, 0);<br>         break;<br>      case true:<br>         _vcam1.LookAt = _target2.transform;<br>         offset = new Vector3(0, 1.5f, 0);<br>         break;<br>   }</strong></pre><pre><strong>   _vcam1Comp.m_TrackedObjectOffset = offset;</strong><br>}</pre><p>Next, I create a switch statement for when the bool is either false or true.</p><p>If false, I want Vcam1 to look at target 1’s transform, which is the drone, Lil Warbot. I also want to make sure the offset is reset by assigning a new Vector with 0 values. I want the virtual camera to track the drone near the center.</p><p>If true, I want Vcam1 to look at target 2’s transform, which is the Project Manager. I also want the ‘Y’ position of the offset to be a value of 1.5f. The virtual camera will track the Project Manager with an anchor around his chest/neck area.</p><p>Lastly, I want to assign the new value from the offset to the “Tracked Object Offset” property.</p><h4>Testing Target Switching</h4><p>When I press the ‘R’ key, the Look At target will change to the next target.</p><pre><strong>private void Update()<br>{<br>   if (Input.GetKeyDown(KeyCode.R))<br>   {<br>      SwitchTarget();<br>   }<br>}</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*thrY6BjdbWLwru5TsCqcSw.gif" /></figure><h4>Switching FOV</h4><p>Now that switching targets are working, let&#39;s change the Field of View when pressing the Space key.</p><p>I create a new method called “SwitchFOV.” It will handle the logic behind switching the Field of View of the virtual camera.</p><pre><strong>private void SwitchFOV()<br>{<br>   int value = 20;<br>   float fov = _vcam1.m_Lens.FieldOfView;<br>   _vcam1.m_Lens.FieldOfView = fov — value;<br>}</strong></pre><p>The int variable will hold a value for the decrement of the Field of View. In this case, it is 20. We want it to go from 60 &gt; 40 &gt; 20 with each Space bar press.</p><p>Next, we need to store a reference of the virtual camera’s Field of View value. It will allow me to subtract the Field of View and the value 20, and assign it to the virtual camera’s Field of View property. I hope that makes sense?</p><pre>private void SwitchFOV()<br>{<br>   int value = 20;<br>   float fov = _vcam1.m_Lens.FieldOfView;<br>   _vcam1.m_Lens.FieldOfView = fov — value;</pre><pre><strong>   if (_vcam1.m_Lens.FieldOfView &lt; 20 &amp;&amp; Input.GetKeyDown(KeyCode.Space))<br>   {<br>      _vcam1.m_Lens.FieldOfView = 60;<br>   }</strong><br>}</pre><p>If the Field of View is less than 20 and the Space key has been pressed, reset the Field of View back to 60.</p><h4>Testing Zoom In On Target</h4><p>When I press the “Space” key, I want to zoom in on the target. By zooming in, I mean by switching the FOV of the camera.</p><pre>private void Update()<br>{<br>   if (Input.GetKeyDown(KeyCode.R))<br>   {<br>      SwitchTarget();<br>   }</pre><pre><strong>   if (Input.GetKeyDown(KeyCode.Space))<br>   {<br>      SwitchFOV();<br>   }</strong><br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*qKZZhqR8Z6jgOFeXkCB1pA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*NaXzyzrwJL7yFzOKlkIL6Q.gif" /></figure><h3>Conclusion</h3><p>Hopefully, we have learned something from this! It is easy to access Cinemachine components through the use of C#. Just remember to use the Cinemachine namespace and store the Virtual Camera component in a variable to access its properties.</p><p>Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86a672ed21a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>