<?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 Alberto Garcia on Medium]]></title>
        <description><![CDATA[Stories by Alberto Garcia on Medium]]></description>
        <link>https://medium.com/@albertogarciaf?source=rss-ecdd5745e1c0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4Zx1zmeQUVWUO2tV3V0nAQ.jpeg</url>
            <title>Stories by Alberto Garcia on Medium</title>
            <link>https://medium.com/@albertogarciaf?source=rss-ecdd5745e1c0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:52:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@albertogarciaf/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[Overview of Swift practices for Apple VisionPro Visualization Prototype]]></title>
            <link>https://albertogarciaf.medium.com/overview-of-swift-practices-for-apple-visionpro-visualization-prototype-1a5d453e5ead?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a5d453e5ead</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[apple-vision-pro]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Mon, 13 Oct 2025 12:35:43 GMT</pubDate>
            <atom:updated>2025-10-13T12:35:43.015Z</atom:updated>
            <content:encoded><![CDATA[<p>This prototype showcases some ways to visualize models and data from different angles utilizing a variety of Swift techniques, covering the fundamental functions for swift + visionOS development. These core components, their functions, and the key Apple APIs are used to build the visionOS prototype.</p><h3>RealityKit and Physics Implementation (TruckColliderBuilder)</h3><p>This script is responsible for creating invisible, simplified collision geometry (colliders) for the 3D model. This is a crucial optimization for physics simulations like wind flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GwkWUFPPL40xqJOHuHBeew.png" /></figure><p>PhysicsMaterialResource.generate(friction:restitution:)</p><p>Defines a custom physics material, in this case, a <strong>low-friction</strong> material (0.05) used for the colliders to ensure simulated objects (like wind particles) slide easily over the surfaces. <a href="https://developer.apple.com/documentation/realitykit/physicsmaterialresource">PhysicsMaterialResource</a></p><p>ModelEntity(mesh:materials:)</p><p>Creates an <strong>invisible entity</strong> for the collider by pairing a generateBox mesh with a SimpleMaterial(color: .clear). The visual mesh exists only to provide the spatial boundaries for the collision component. <a href="https://developer.apple.com/documentation/realitykit/modelentity">ModelEntity</a></p><p>CollisionComponent(shapes:)</p><p>Defines the specific shape that the physics engine should use for collision detection. Here, a simplified box shape is applied to the invisible ModelEntity. <a href="https://developer.apple.com/documentation/realitykit/collisioncomponent">CollisionComponent</a></p><p>PhysicsBodyComponent(mode: .static)</p><p>Sets the behavior of the collider. Using .static ensures the colliders are fixed in world space and cannot be moved by physics forces, acting as immovable geometry. <a href="https://developer.apple.com/documentation/realitykit/physicsbodycomponent">PhysicsBodyComponent</a></p><p>root.addChild(ramp)</p><p>Attaches the newly created colliders (ramp, fairingRamp, topBlocker) to the main truck entity, making them active within the scene graph. <a href="https://developer.apple.com/documentation/realitykit/hashierarchy/addchild(_:preservingworldtransform:)">Entity/addChild(_:)</a></p><h3>State Management &amp; Data Models (AppModel, ViewModel)</h3><p>The most complex part of a visionOS app is safely managing the transition into and out of an immersive space. Since these actions are asynchronous (they take time and can fail), a robust state machine is mandatory. These two files manage the data and state transitions for the entire application, separating the data logic from the SwiftUI view presentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-dzKAaRh9PQODCYEXHA1w.png" /><figcaption>UI Navigation</figcaption></figure><p>@Observable class AppModel</p><p><strong>Manages Immersive Space State:</strong> Tracks the status of the dedicated immersive space (.closed, .inTransition, or .open). This state machine is essential for controlling the asynchronous nature of opening and dismissing the space. <a href="https://developer.apple.com/documentation/observation/observable()"><strong>@Observable</strong></a></p><p>enum ImmersiveSpaceState</p><p>Defines the three possible states for the immersive space lifecycle, allowing for robust transition handling. <a href="https://developer.apple.com/documentation/visionOS/creating-immersive-spaces-in-visionos-with-swiftui">Swift Enumerations</a> for Immersive Space State</p><p>@Observable class ViewModel</p><p><strong>Manages Feature State:</strong> Holds the boolean flags (e.g., isAirTunnelActive, isShowingLights) that control the truck&#39;s interactive features. Views and RealityKit logic subscribe to changes in these properties.</p><h3>UI &amp; Immersive Space Control (ToggleImmersiveSpaceButton)</h3><p>Core control for the user experience, providing a reliable way to switch between a standard window and the full-immersion environment.</p><p>@Environment(\.openImmersiveSpace) &amp; @Environment(\.dismissImmersiveSpace)</p><p><strong>Asynchronous UI Actions:</strong> These are special environment properties provided by visionOS that allow a view to programmatically request the opening or closing of an immersive space. <a href="https://developer.apple.com/documentation/swiftui/environmentvalues/openimmersivespace">openImmersiveSpace</a></p><p>Task { @MainActor in ... }</p><p>Wraps the asynchronous operations. Because opening/closing a space can take time, this ensures the UI thread is used and the operation is handled efficiently without blocking the interface. <a href="https://developer.apple.com/documentation/swift/task">Task</a></p><p>switch await openImmersiveSpace(id: ...)</p><p>Handles the result of the asynchronous open operation, allowing the code to react differently if the space opened successfully, was cancelled by the user, or returned an error. <a href="https://developer.apple.com/documentation/swiftui/openimmersivespaceaction/result">OpenImmersiveSpaceAction.Result</a></p><p>.disabled(appModel.immersiveSpaceState == .inTransition)</p><p>A key user experience safeguard that disables the button while the space is transitioning, preventing input chaos and ensuring the state machine finishes correctly. <a href="https://developer.apple.com/documentation/swiftui/view/disabled(_:)">View/disabled(_:)</a></p><h3>Content Loading (RealityView Files)</h3><p><strong>T</strong>hese simple views are the bridge between your SwiftUI application and the 3D content exported from Reality Composer Pro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3UeHqldSmzkTy5BUZ_s0mQ.png" /></figure><p>A Portal is an optional, spatially-placed window into an Immersive Space. Instead of being completely sealed off, the user steps through a door, or peers through a hole, to experience the virtual environment while retaining a connection to their real surroundings.</p><p>This technique is unique to AVP because it directly leverages the <strong>pass-through reality</strong> capabilities, creating a sense of presence and continuity between the physical and digital worlds that traditional VR platforms cannot replicate. Structurally, a portal still requires the same robust asynchronous control (openImmersiveSpace/dismissImmersiveSpace) to manage the transition smoothly.</p><p>RealityView { content in ... }</p><p>The main container for rendering 3D content in a visionOS app. It provides the content entity where all scene assets are added. <a href="https://developer.apple.com/documentation/RealityKit/RealityView">RealityView</a></p><p>Entity(named: &quot;SceneMM&quot;, in: realityKitContentBundle)</p><p><strong>Asynchronous Asset Loading:</strong> Safely attempts to load the named 3D scene (SceneMM or SceneMini) exported from Reality Composer Pro. This is an await call because asset loading is asynchronous. <a href="https://developer.apple.com/documentation/realitykit/entity/load(named:in:)">Load(named:in:)</a></p><p>content.add(entity)</p><p>Once the 3D entity is loaded, this line adds the model, which serves as the root of the entire 3D scene, to the view’s rendering pipeline. <a href="https://developer.apple.com/documentation/realitykit/realityviewcontentprotocol/add(_:)">RealityView.Content/add(_:)</a></p><p>These are some of the fundamental visionOS + swift techniques. For future exploration, the most exciting frontier lies in integrating <strong>direct hand tracking and gesture recognition</strong> via the <strong>HandAnchor</strong> APIs, allowing users to physically push the virtual wind tunnel controls with their fingers. Developers can also explore niche spatial APIs like <strong>Plane Detection</strong> and <strong>Spatial Anchors</strong> to ground the truck visualization persistently in the user&#39;s real room. For content creators, leveraging <strong>Object Capture</strong> (the Apple-provided API for generating photo-realistic 3D models from real-world pictures) or integrating <strong>Volumetric Video</strong> (for capturing and displaying real people in 3D space) offers a path to truly transformative, real-world data visualization. These techniques represent the highest ceiling of spatial computing, promising interactivity and immersion far beyond what traditional screens can deliver.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a5d453e5ead" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selection Interaction for Vision OS with Unity Polyspatial — Apple Vision Pro Hand Interactions]]></title>
            <link>https://albertogarciaf.medium.com/selection-interaction-for-vision-os-with-unity-polyspatial-apple-vision-pro-hand-interactions-fc351216b48c?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc351216b48c</guid>
            <category><![CDATA[apple-vision-pro]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[visionos]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[polyspatial]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Thu, 08 Feb 2024 21:33:37 GMT</pubDate>
            <atom:updated>2024-02-08T21:33:37.685Z</atom:updated>
            <content:encoded><![CDATA[<h3>Selection Interaction for Vision OS with Unity Polyspatial — Apple Vision Pro Hand Interactions</h3><p>Unity did it again. They have bridged development access to a new platform through an easy-to-use SDK. To address the needs of the Vision OS and its shared space apps, multiple windows and 3D volumes of interactable and independent software, Unity created <a href="https://docs.unity3d.com/Packages/com.unity.polyspatial.visionos@1.0/manual/index.html">Polyspatial</a>. As the name suggests, this collection of technologies target most features that any AR or MR app could need. For this example, I will simply share one of the most fundamental interactions for any app; a selection similar to a mouse click that works by pinching the thumb and index finger together.</p><p>Before we start, you must know that Unity PolySpatial and visionOS support is only available to Unity Pro, Unity Enterprise, and Unity Industry users, you need Apple Silicon (M1, M2 or greater), XCode 15.2 and if you don’t have visionOS hardware, you can use the simulator built into XCode. Here&#39;s a look at the rest of r<a href="https://docs.unity3d.com/Packages/com.unity.polyspatial.visionos@1.0/manual/Requirements.html">equirements</a>.</p><p>Let&#39;s set up the project in Unity 2022.3.18f1 or higher. I&#39;m using the URP and have installed the following packages:</p><ul><li>com.unity.polyspatial (1.0.3)</li><li>com.unity.xr.visionos (1.0.3)</li><li>com.unity.polyspatial.visionos (1.0.3)</li><li>com.unity.polyspatial.xr (1.0.3)</li></ul><p>Within the Polyspatial package inside the package manager, you may find and import the samples. This example shows how to edit the Balloon Gallery interaction for your own purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*nWbEMo2_okPAMtgKTqUCNA.png" /></figure><p>This sample works by directly or indirectly touching with the index finger or tapping (pinching) your index + thumb together. The magic of the Vision Pro lies in it&#39;s eye-tracking capabilities, as your eyes work as the cursor to point on the exact object that you want to interact with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*-tfTP1l4vMQlZSqfInyBWw.gif" /></figure><p>Let&#39;s take a look at the code and make our adjustments.</p><pre>using Unity.PolySpatial.InputDevices;<br>using UnityEngine;<br>using UnityEngine.InputSystem.EnhancedTouch;<br>using UnityEngine.InputSystem.LowLevel;<br>using Touch = UnityEngine.InputSystem.EnhancedTouch.Touch;<br>using TouchPhase = UnityEngine.InputSystem.TouchPhase;<br><br>namespace PolySpatial.Samples<br>{<br>    public class GalleryInputManager : MonoBehaviour<br>    {<br>        [SerializeField]<br>        Transform m_InputAxisTransform;<br><br>        void OnEnable()<br>        {<br>            // enable enhanced touch support to use active touches for properly pooling input phases<br>            EnhancedTouchSupport.Enable();<br>        }<br><br>        void Update()<br>        {<br>            var activeTouches = Touch.activeTouches;<br><br>            if (activeTouches.Count &gt; 0)<br>            {<br>                var primaryTouchData = EnhancedSpatialPointerSupport.GetPointerState(activeTouches[0]);<br>                if (activeTouches[0].phase == TouchPhase.Began)<br>                {<br>                    // allow balloons to be popped with a poke or indirect pinch<br>                    if (primaryTouchData.Kind == SpatialPointerKind.IndirectPinch || primaryTouchData.Kind == SpatialPointerKind.Touch)<br>                    {<br>                        var balloonObject = primaryTouchData.targetObject;<br>                        if (balloonObject != null)<br>                        {<br>                            if (balloonObject.TryGetComponent(out BalloonBehavior balloon))<br>                            {<br>                                balloon.Pop();<br>                            }<br>                        }<br>                    }<br><br>                    // update input gizmo<br>                    m_InputAxisTransform.SetPositionAndRotation(primaryTouchData.interactionPosition, primaryTouchData.inputDeviceRotation);<br>                }<br><br>                // visualize input gizmo while input is maintained<br>                if (activeTouches[0].phase == TouchPhase.Moved)<br>                {<br>                    m_InputAxisTransform.SetPositionAndRotation(primaryTouchData.interactionPosition, primaryTouchData.inputDeviceRotation);<br>                }<br>            }<br>        }<br>    }<br>}</pre><p>This script works along the BalloonBehavior script to call the method Pop() that runs the popping animation with the particle effect.</p><p>I will use this base script to create an interaction where I click on three different game objects to set a path laid by pillars coming down for a bridge. I will use a switch method to use only one Tag for all three objects and to let players decide in which order to click the three elements to give players freedom of choice. Let&#39;s take a look at the edited script. All of the changes occur within the Update method:</p><pre>void Update()<br>        {<br>            var activeTouches = Touch.activeTouches;<br><br>            if (activeTouches.Count &gt; 0)<br>            {<br>                var primaryTouchData = EnhancedSpatialPointerSupport.GetPointerState(activeTouches[0]);<br>                if (activeTouches[0].phase == TouchPhase.Began)<br>                {<br>                    // allow object to be interacted with a poke or indirect pinch<br>                    if (primaryTouchData.Kind == SpatialPointerKind.IndirectPinch || primaryTouchData.Kind == SpatialPointerKind.Touch)<br>                    {<br>                        var interactedObject = primaryTouchData.targetObject;<br>                        if (interactedObject != null &amp;&amp; interactedObject.tag == &quot;Track&quot;)<br>                        {<br>                            if (interactedObject.TryGetComponent(out PillarButton pillar))<br>                            {<br>                                pillar.CallTracks();<br>                            }<br>                        }<br><br>                        else if (interactedObject != null &amp;&amp; interactedObject.tag == &quot;UIButton&quot;)<br>                        {<br>                            if (interactedObject.TryGetComponent(out UIButton button))<br>                            {<br>                                button.UIButtonPress();<br>                            }<br>                        }<br><br>                        else if (interactedObject != null &amp;&amp; interactedObject.tag == &quot;ChangeScene&quot;)<br>                        {<br>                            if (interactedObject.TryGetComponent(out ChangeScene loader))<br>                            {<br>                                loader.LoadMainScene();<br>                            }<br>                        }<br>                    }<br><br>                    // update input gizmo<br>                    m_InputAxisTransform.SetPositionAndRotation(primaryTouchData.interactionPosition, primaryTouchData.inputDeviceRotation);<br>                }<br><br>                // visualize input gizmo while input is maintained<br>                if (activeTouches[0].phase == TouchPhase.Moved)<br>                {<br>                    m_InputAxisTransform.SetPositionAndRotation(primaryTouchData.interactionPosition, primaryTouchData.inputDeviceRotation);<br>                }<br>            }<br>        }</pre><p>By taking a look at how this new input system works, we can say that the Touch Phase begins a new interaction, upon detecting an interacted object, we can start customizing the target object&#39;s response by making sure that each tag corresponds to the script that we are looking for in the interacted object. On the same interaction scripts we can see that we can manage UI Buttons, Changing Scenes as well as our example of setting the pillars for our bridge. Here is how the PillarButton script looks to respond to this touch interaction:</p><pre>using System.Collections;<br>using System.Collections.Generic;<br>using UnityEngine;<br><br>public class PillarButton : MonoBehaviour<br>{<br>    [SerializeField]<br>    private int _pillarID;<br>    [SerializeField]<br>    private TrainTracksBehaviour _tracksScript;<br>    private Collider _thisCollider;<br><br>    private void Start()<br>    {<br>        _thisCollider = GetComponent&lt;Collider&gt;();<br>    }<br><br>    public void CallTracks()<br>    {<br>        switch (_pillarID)<br>        {<br>            case 0:<br>                _tracksScript.SetTrackOne();<br>                _thisCollider.enabled = false;<br>                break;<br>            case 1:<br>                _tracksScript.SetTrackTwo();<br>                _thisCollider.enabled = false;<br>                break;<br>            case 2:<br>                _tracksScript.SetTrackThree();<br>                _thisCollider.enabled = false;<br>                break;<br>        }<br>    }<br>}</pre><p>By using the switch statement, I can easily give each interactable button a _pillarID and allow players to click the buttons in any particular order as well as fitting all this interaction within one script. This is our final result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*4QvlSsAp6X8-Ayy93rVshw.gif" /></figure><p>The Polyspatial package really simplifies in an elegant and delicate manner the ability to interact with 3D objects with the Vision Pro. On the next article, I will discuss the manipulation sample that comes with Polyspatial and how to customize it for a specific use case.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc351216b48c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intro to Timeline]]></title>
            <link>https://albertogarciaf.medium.com/intro-to-timeline-f5461b8473b4?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5461b8473b4</guid>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Thu, 19 Oct 2023 18:32:07 GMT</pubDate>
            <atom:updated>2023-10-19T18:32:07.438Z</atom:updated>
            <content:encoded><![CDATA[<p>Fundamental features of timeline, a non-linear editor that comes with the Cinemachine package. An easy-to-view system for directing animations. To access Timeline go to Window -&gt; Sequencing -&gt; Timeline.</p><p><strong>Simple and Multiple Animations on the Same Object</strong></p><p><em>Definition</em>: Using Timeline, you can create animations on a single object, enabling smooth transitions between different animation states.</p><p><em>Example</em>: An character in a game can seamlessly transition from an idle animation to a walking animation as the player starts moving the character.</p><p><strong>Animation Track</strong></p><p><em>Definition</em>: An Animation Track in Timeline allows you to control and sequence animations for a GameObject.</p><p><em>Example</em>: You can use an Animation Track to make a character jump and then transition into a somersault animation before landing.</p><p><strong>Timeline Controls</strong></p><p><em>Definition</em>: Timeline provides a user interface for precise control over the timing and sequencing of events and animations.</p><p><em>Example</em>: You can use Timeline controls to synchronize a character’s dialog with specific moments in a cutscene.</p><p><strong>Pre and Post Extrapolation</strong></p><p><em>Definition</em>: Pre and Post Extrapolation determine how animations behave before the first keyframe and after the last keyframe in a Timeline.</p><p><em>Example</em>: Pre Extrapolation can be used to have an object smoothly approach the starting point before its initial keyframe.</p><p><strong>Matching Clip Offsets</strong></p><p><em>Definition</em>: Matching clip offsets ensure that animations play smoothly without abrupt jumps or unwanted pauses between different clips in Timeline.</p><p><em>Example</em>: In a character’s action sequence, matching clip offsets help the character fluidly transition from walking to running animations without noticeable pauses.</p><p><strong>Activation Track</strong></p><p><em>Definition</em>: An Activation Track in Timeline controls the activation and deactivation of GameObjects during a sequence.</p><p><em>Example</em>: You can use an Activation Track to turn lights on or off as a character moves through a dark corridor.</p><p><strong>Audio Track</strong></p><p><em>Definition</em>: The Audio Track in Timeline enables the synchronization of audio clips with specific moments in your scene.</p><p><em>Example</em>: In a cinematic sequence, the Audio Track can trigger a dramatic sound effect as a spaceship takes off.</p><p><strong>Control Track</strong></p><p><em>Definition</em>: The Control Track in Timeline lets you modify parameters of components or scripts in your scene over time.</p><p><em>Example</em>: Using a Control Track, you can change the color of a character’s clothing gradually as they move from one location to another.</p><p><strong>Signal Emitter</strong></p><p><em>Definition</em>: A Signal Emitter sends signals within Timeline to trigger events or actions.</p><p><em>Example</em>: A Signal Emitter can be used to trigger a special effect, like an explosion, when the player reaches a certain point in a game level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvoewQ2m3I684pg21ysB5Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5461b8473b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Combining Cinemachine and Timeline for Ultimate Control]]></title>
            <link>https://albertogarciaf.medium.com/combining-cinemachine-and-timeline-for-ultimate-control-7ca7b50c1788?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ca7b50c1788</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[cinemachine]]></category>
            <category><![CDATA[timeline]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Sat, 23 Sep 2023 03:26:17 GMT</pubDate>
            <atom:updated>2023-09-23T03:26:17.978Z</atom:updated>
            <content:encoded><![CDATA[<p>Cinemachine and Timeline are two powerful Unity3D tools that can be combined to create immersive and cinematic cutscenes and gameplay experiences.</p><p><strong>Using Timeline and Cinemachine to Take Away Player Input</strong></p><p>One way to use Timeline and Cinemachine is to take away player input to fully focus on a cinematic cutscene or event occurring at a specific time in gameplay. This can be useful for creating moments where the player is simply a spectator, such as when opening a treasure chest or reaching a point on a street where a car suddenly appears to pick you up.</p><p>This is the Treasure director timeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*Q02gRtTQvwTFCbyN1Eo4kg.png" /></figure><p>Once you have set up your Timeline asset, you can play it back to preview the cutscene or event. When you are happy with the results, you can attach the Timeline asset to a GameObject in your scene and trigger it when desired. Here, I’ve specified that during this timeline, the Main Camera will use the CM Vcam 1 and thanks to priorities, it goes back to the main virtual cam after the timeline ends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*DZ2qd0dyaJ0ekVDz46BaQQ.gif" /></figure><p>To activate the Cinemachine Virtual Cameras, you can use a combination of the following steps:</p><ol><li>Add a Signal Emitter to the Timeline Director GameObject.</li><li>Use the control/activation track on timeline.</li><li>Use c# code to activate it through triggers.</li></ol><p>Another example of how timeline can take control of cinemachine and focus on the animation at hand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*ltflDMn52x_O-lvqHwsVLg.gif" /></figure><p>By combining Timeline and Cinemachine, you can create cinematic cutscenes and gameplay experiences where you have ultimate control over the player’s experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ca7b50c1788" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making a  Treasure Chest Time— Unity3D]]></title>
            <link>https://albertogarciaf.medium.com/making-a-treasure-chest-time-unity3d-85da1e2bd8f2?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/85da1e2bd8f2</guid>
            <category><![CDATA[timeline]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Tue, 19 Sep 2023 00:50:30 GMT</pubDate>
            <atom:updated>2023-09-19T00:50:30.338Z</atom:updated>
            <content:encoded><![CDATA[<h3>Making a Treasure Chest Timeline Animation— Unity3D</h3><p>To make a treasure chest system using Timeline, you will need to:</p><ol><li>Create a new Timeline asset.</li><li>Add an Animation Track to the Timeline asset and assign the animation clip for the treasure chest opening animation to the track.</li><li>Add a Particle System Track to the Timeline asset and assign the particle system for the treasure chest opening animation to the track.</li><li>Add an Audio Track to the Timeline asset and assign the sound effect for the treasure chest opening animation to the track.</li><li>Create a new C# script and attach it to the treasure chest GameObject.</li><li>In the script, add a public variable for the Timeline Director.</li><li>Add a OnTriggerEnter() method to the script.</li><li>In the OnTriggerEnter() method, play the Timeline Director.</li></ol><p>Here is a simple C# script for the treasure chest system:</p><pre>using UnityEngine;<br>using UnityEngine.Playables;<br>public class TreasureChest : MonoBehaviour<br>{<br>  public PlayableDirector timelineDirector;<br><br>  private void OnTriggerEnter(Collider other)<br>    {<br>        if (other.gameObject.tag == &quot;Player&quot;)<br>        {<br>            timelineDirector.Play();<br>        }<br>    }<br>}</pre><p>To set up the treasure chest opening animation with a particle system and sound, you will need to:</p><ul><li>Create a new particle system for the treasure chest opening animation.</li><li>Create a new audio clip for the treasure chest opening animation.</li><li>Add the particle system to the Particle System Track in the Timeline asset.</li><li>Add the audio clip to the Audio Track in the Timeline asset.</li><li>Adjust the timing of the particle system and audio clip so that they match the treasure chest opening animation.</li></ul><p>Once you have set up the treasure chest opening animation, you can place the treasure chest GameObject in your scene and test it out. When the player enters the trigger collider of the treasure chest, the Timeline Director will play and the treasure chest will open, revealing the loot inside.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*6dTP56kyhnQ3p-D5LiN4Hw.png" /></figure><p>Here are some additional tips for creating a treasure chest system using Timeline:</p><ul><li>You can use multiple animation clips in the Timeline asset to create a more complex treasure chest opening animation.</li><li>You can use masks to control which parts of the treasure chest animation are affected by the Timeline Director.</li><li>You can use signal emitters to trigger the Timeline Director from other objects in the scene.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*tPKanp0bitsc8T5D9BifZw.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85da1e2bd8f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running to Victory — Timeline Animation in Unity3D]]></title>
            <link>https://albertogarciaf.medium.com/running-to-victory-timeline-animation-in-unity3d-9839ea69128b?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9839ea69128b</guid>
            <category><![CDATA[timeline]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Wed, 13 Sep 2023 00:00:41 GMT</pubDate>
            <atom:updated>2023-09-13T00:00:41.488Z</atom:updated>
            <content:encoded><![CDATA[<h3>Running to Victory — Timeline Animation in Unity3D</h3><p>The challenge here is to mix animation clips to create a finish-line type of victory celebration. A character runs to a goal, lifting its arms up with joy and a sudden plot twist has the character limp out of the scene. For this I mixed four character animations; two as the main channel for the running and limping animations, an override track to mix both victory animations with an avatar mask that animates only the arms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d1okEtjpRI9gdi1kkJU7GQ.png" /></figure><p>The Celebration game object holds 6 particle systems that activate when the player reaches the ship’s remote start-engine button. Camera Holder is an object for the vcam to follow as body. It is animated with three key frames that run along the robot’s path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*56DJMpHulT33tSGvNuA5BQ.gif" /></figure><p>This is the set up for the override track avatar mask.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*vEgjqmUbRXzSZjpyMl4v8w.png" /></figure><p>This is the general overview of the timeline window below the</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*UiiH8pE6ltNR3q70IwqdhA.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9839ea69128b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Character Animation in Timeline with Different Clips]]></title>
            <link>https://albertogarciaf.medium.com/character-animation-in-timeline-with-different-clips-260fc73bc821?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/260fc73bc821</guid>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[timeline]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Tue, 12 Sep 2023 00:00:07 GMT</pubDate>
            <atom:updated>2023-09-12T00:00:07.620Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>How to Add Different Animation Clips to a Character on Timeline</strong></p><p>To add different animation clips to a character on Timeline, you first need to create a Timeline track for the character. You can do this by clicking on the “+” button in the track header and selecting “Animation Track” from the menu.</p><p>Once you have created an animation track, you need to drag and drop an animation clip onto the track.</p><p>You can also add multiple animation clips to the same track. To do this, simply drag and drop additional animation clips onto the track.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*JEPZd-of9ZpntvgOy1KB-Q.png" /></figure><p>The animation clips will be played in order, from the top of the track to the bottom. You can change the order of the animation clips by dragging and dropping them.</p><p>You can also preview the animation clips by clicking on them in the Timeline window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*egDaYVz2oCtOOu-sA9OXbw.gif" /></figure><p><strong>Basic Functionality of an Override Track</strong></p><p>An override track is a special type of track that allows you to override the animation on another track. This can be useful for mixing different animation clips, or for applying special effects to an animation.</p><p>To create an override track, you first need to create a new animation track. Then, you need to set the track type to “Override”.</p><p>Once you have created an override track, you need to drag and drop an animation clip onto the track.</p><p>The animation clip on the override track will override the animation on the track that it is connected to.</p><p><strong>How to Use an Override Track to Mix Lower and Upper Body Movement</strong></p><p>You can use an override track to mix lower and upper body movement by using a mask. A mask is a value that determines which parts of the animation are affected by the override track.</p><p>To create a mask, you first need to create a new animation clip. Then, you need to set the track type to “Mask”.</p><p>Once you have created a mask clip, you need to drag and drop it onto the override track.</p><p>The mask clip will determine which parts of the animation on the main track are affected by the override track.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*C5P5_KD_Na4Jb0qdQ7p0ZA.png" /></figure><p>For example, you could create a mask clip that only affects the lower body of a character. This would allow you to play an animation for the upper body, while using a different animation for the lower body.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*mGRpMpMU9JEL2p-AShCr5Q.gif" /></figure><p>Timeline is a powerful tool that can be used to create complex animations for characters. By understanding how to use animation tracks and masks, you can create animations that are both realistic and engaging.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=260fc73bc821" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Signal Emitters to Access C# Scripts]]></title>
            <link>https://albertogarciaf.medium.com/using-signal-emitters-to-access-c-scripts-f98d6c7c240f?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f98d6c7c240f</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[timeline]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Mon, 11 Sep 2023 20:27:51 GMT</pubDate>
            <atom:updated>2023-09-11T20:27:51.178Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is a Signal Emitter?</strong></p><p>A signal emitter is a Unity3D object that can be used to emit signals. Signals are events that can be sent to other objects in the scene.</p><p><strong>How to Use Signal Emitters</strong></p><p>To use a signal emitter, you first need to create one by showing timeline markers, then clicking on the right mouse button on the marker bar and select “add Signal Emitter” on the desired frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*4nqyj7Rgf-Db8TtQmeVZBg.gif" /></figure><p>Once you have created a signal emitter, you need to give it a name. You can also specify a time delay before the signal is emitted.</p><p><strong>How to Access C# Scripts with Signal Emitters</strong></p><p>You can use signal emitters to access C# scripts by attaching a signal receiver to the script. A signal receiver is an object that can receive signals.</p><p>To attach a signal receiver to a C# script, you first need to create one. You can do this by clicking on the “+” button in the GameObject menu and selecting “Signal Receiver”.</p><p>Once you have created a signal receiver, you need to drag and drop it onto the C# script.</p><p>When a signal is emitted, the signal receiver will call the onSignal() method on the C# script. You can use this method to perform any actions that you want.</p><p><strong>Examples of How Signal Emitters Can Be Used</strong></p><p>Signal emitters can be used to a variety of things, including:</p><ul><li><strong>Triggering events:</strong> Signal emitters can be used to trigger events in your game. For example, you could use a signal emitter to trigger a cutscene when the player reaches a certain point in the game.</li><li><strong>Communicating between objects:</strong> Signal emitters can be used to communicate between objects in your game. For example, you could use a signal emitter to let one object know when another object has been destroyed.</li><li><strong>Controlling gameplay:</strong> Signal emitters can be used to control gameplay in your game. For example, you could use a signal emitter to make an enemy spawn when the player enters a certain area or change a scene at the end of a timeline animation.</li></ul><p>Here I will try two things, debugging a specific moment on Timeline 01 when Timeline 02 is initiated, and a second signal at the end of Timeline 02 to change a scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*FkskR4p5PHTgth3O0C-O8Q.gif" /></figure><p>Signal emitters are a powerful tool that can be used to control your game’s logic. By understanding how they work, you can use them to create a variety of complex and engaging gameplay experiences.</p><p>Here are some specific examples of how signal emitters can be used:</p><ul><li>A signal emitter could be used to trigger a cutscene when the player reaches a certain point in the game. The signal emitter could be attached to the player’s GameObject, and the signal could be emitted when the player enters a certain area.</li><li>A signal emitter could be used to communicate between two enemies in a game. The signal emitter could be attached to one enemy, and the signal could be emitted when the enemy is destroyed. The other enemy could then be programmed to react to the signal, such as by becoming more aggressive.</li><li>A signal emitter could be used to control gameplay in a game. The signal emitter could be attached to a GameObject that represents a health bar. The signal could be emitted when the health bar reaches a certain level, and the game could then be programmed to take some action, such as spawning a new enemy or making the player character invincible.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f98d6c7c240f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Control Track in Timeline — Unity3D]]></title>
            <link>https://albertogarciaf.medium.com/control-track-in-timeline-unity3d-cf1da80e25?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf1da80e25</guid>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[timeline]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Tue, 05 Sep 2023 19:36:33 GMT</pubDate>
            <atom:updated>2023-09-05T19:36:33.277Z</atom:updated>
            <content:encoded><![CDATA[<h3>Control Track in Timeline — Unity3D</h3><p><strong>What is a Control Track?</strong></p><p>A control track is a special type of track in the Unity3D Timeline window that allows you to control the playback of time-based elements in your scene. This means that you can play, pause, stop, and loop time-based elements, as well as control their speed and direction.</p><p><strong>Benefits of Using Control Tracks</strong></p><p>Control tracks offer a number of benefits, including:</p><ul><li><strong>Flexibility:</strong> Control tracks allow you to control the playback of time-based elements in a very flexible way. You can play, pause, stop, and loop elements, as well as control their speed and direction.</li><li><strong>Power:</strong> Control tracks give you a lot of power over the playback of time-based elements. You can use them to create complex sequences that would be difficult or impossible to create with other methods.</li><li><strong>Efficiency:</strong> Control tracks can be used to save time and effort when creating complex sequences. You can reuse control tracks in different scenes, and you can also use them to automate tasks.</li></ul><p>Control tracks can be used to create a variety of movie-like sequences, including:</p><ul><li><strong>Cutscenes:</strong> Control tracks can be used to create cutscenes, which are short, pre-rendered sequences that are played during the game. Cutscenes can be used to advance the story, introduce new characters, or provide exposition.</li><li><strong>Cinematics:</strong> Control tracks can also be used to create cinematics, which are longer, more complex sequences that are rendered in real time. Cinematics can be used to create a sense of awe and wonder, or to tell a more detailed story.</li><li><strong>Interactive sequences:</strong> Control tracks can also be used to create interactive sequences, which are sequences that the player can control. Interactive sequences can be used to create puzzles, challenges, or even entire games.</li></ul><p>Here is how my control track on timeline 1 is activating the second timeline to easily match the timing and being able to customize each timeline individually. Making timeline 2 an easily repeatable animation that works in many cases and not just with timeline 01. Timeline 2 is controlled on the third track of timeline 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8kRSH5AuwdcoByAbOgz8Ng.gif" /></figure><p><strong>Conclusion</strong></p><p>Control tracks are a powerful tool that can be used to create a variety of movie-like sequences in Unity3D. By understanding how they work, you can use them to create sequences that are both visually stunning and engaging.</p><p>Here are some specific examples of how control tracks can be used to create movie-like sequences:</p><ul><li>A control track could be used to create a cutscene where a character walks down a hallway. The control track could be used to control the speed and direction of the character’s movement, as well as the playback of any audio or visual effects that are associated with the scene.</li><li>A control track could be used to create a cinematic where a spaceship flies through space. The control track could be used to control the speed and direction of the spaceship’s movement, as well as the playback of any explosions or other special effects that are associated with the scene.</li><li>A control track could be used to create an interactive sequence where the player has to solve a puzzle. The control track could be used to control the movement of objects in the scene, as well as the playback of any audio or visual clues that are associated with the puzzle.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf1da80e25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Audio Tracks in Timeline — Unity3D]]></title>
            <link>https://albertogarciaf.medium.com/audio-tracks-in-timeline-unity3d-63f2a158611c?source=rss-ecdd5745e1c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/63f2a158611c</guid>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[timeline]]></category>
            <category><![CDATA[sound]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[unity-game-development]]></category>
            <dc:creator><![CDATA[Alberto Garcia]]></dc:creator>
            <pubDate>Tue, 05 Sep 2023 19:05:45 GMT</pubDate>
            <atom:updated>2023-09-05T19:05:45.666Z</atom:updated>
            <content:encoded><![CDATA[<h3>Audio Tracks in Timeline — Unity3D</h3><p><strong>What is an Audio Track?</strong></p><p>An audio track is a special type of track in the Unity3D Timeline window that allows you to control the playback of audio clips in your scene. This means that you can play, pause, stop, and loop audio clips, as well as control their volume and pitch, easily synchronizing it with animations and VFXs.</p><p><strong>Why Are Audio Tracks Useful?</strong></p><p>Audio tracks are useful for a variety of purposes, including:</p><ul><li><strong>Creating complex audio experiences:</strong> You can use audio tracks to create complex audio experiences, such as music scores, sound effects, and environmental audio.</li><li><strong>Creating cinematics:</strong> You can use audio tracks to create cinematics, such as cutscenes or gameplay trailers. This can be useful for creating smooth, seamless transitions between scenes, or for adding atmosphere to your scene.</li><li><strong>Debugging your game:</strong> You can use audio tracks to debug your game. For example, you can use them to play audio clips to see how they affect your game’s performance.</li></ul><p><strong>How to Use Audio Tracks</strong></p><p>To use an audio track, you first need to create a new audio track in the Timeline window. You can do this by clicking on the “+” button in the track header and selecting “Audio Track” from the menu.</p><p>Once you have created an audio track, you need to add an audio clip to the track. You can do this by dragging and dropping an audio clip onto the track.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FqlHQm_1jCa0N3-9dp4Hqw.gif" /></figure><p>Make sure an Object in the hierarchy has an audio source, and place it as input for the audio track field in Timeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*Bghs9mIs_PT_esq51qKloA.png" /></figure><p>Once the audio clip is added to the track, you can start to control its playback. You can play, pause, stop, and loop the audio clip, as well as control its volume and pitch.</p><p>You can also use curves to control the playback of the audio clip over time. To do this, right-click on the audio track and select “Add Curve” from the menu.</p><p>For now, I will simply cut the audio recording to the length I need it by placing the time handler at the end of my animation recording and hitting “S” on the keyboard to split.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*FsauLYzTGfEAHLPrc2RlEg.gif" /><figcaption>Typgin S to split selected recording.</figcaption></figure><p>Audio tracks are a powerful tool that can be used to create a variety of audio experiences in Unity3D. By understanding how they work, you can use them to create complex, immersive audio experiences for your games.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63f2a158611c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>