Building Virtual Worlds - 3 - Digital Twin

 The Assignment

For this assignment, the class was tasked with creating a virtual digital twin experience using Unity. The goal was to design and develop a virtual environment that mirrored a real-world location such as a museum, a historical site, a nature park, or a more imaginative space such as film set. Users should be able to explore the virtual environment, interact with objects, and learn more about the location and interact with overlay displays through informative pop-ups, audio narration, and visual cues.  

Techniques and interactions should include the ability to:

  • Grab and manipulate objects 
  • Trigger Animation
  • Teleport across the terrain or to specific spots in the scene

Initially I was going to recreate a place that was familiar and that would also encourage exploration, like a kitchen. That idea proved to be a bit mundane, and so I pivoted to my backup, exploring an adventurous cavern from the world of Indiana Jones!

The Final Product

The Big Idea

The sense of adventure created by the Indiana Jones films had a profound impact on how I integrate playfulness, danger, intensity, and adventure into my creative works. Even if these elements are not central to the main idea, they inform the work on an emotional level. Additionally, as a Florida native, I was fortunate to witness the live Indiana Jones stunt show performed at Disney-MGM Studios, which made the adventures feel more real in my young mind. Undertaking a virtual adventure seemed like the perfect challenge, offering a set of obstacles for users to navigate through.

Concerns

Since adventures generally involve a lot of rapid movement I had concerns about whether this experience would be comfortable to the user.  

To address this, I built specific anchor points along the terrain to encourage users to teleport forward and to motion sickness.

About the Adventure

The experience begins with the user getting a prompt from Indy asking for help to retrieve the golden fertility idol from a dangerous temple/cavern.

The user traverses up a flight of ancient ruins and travels though a cave only to be blocked by a large circular wall. The user notices that the stone can be triggered to open by placing the missing center stone back into it's place. 


Once the wall is triggered to open, the user needs to find a way to get across a large ravine. Luckily a large plank of wood is available and it must be grabbed and placed to allow the user to cross to the other side of the temple without falling into a large pit.

As the user gets closer to the golden idol, the next set of obstacles is a set of spikes that spring from the ground if the user steps on the wrong floor tile!  This was accomplished by adding trigger colliders to specific tiles that would trigger an animation of the spikes.  Each spike has it's own box collider which prevents the users from passing though it.  

 

Once the user finally makes it to the end of the temple, they can grab the golden idol and bring it to a museum, where it belongs!  

Going on a Midjourney...

I was short on time and thought it would be interesting to see if AI could speed up production on User Interface design.

I created a prompt asking for UI in an adventure game.  I then saved the results, opened the one I liked in Photoshop and made edits.  It was more involved than that simple explanation, but the truth is that it saved me several hours worth of work.

Below are the AI outputs:

Edits were still needed:
This button is all mine (c) Copyright Noel Nunez 2023

I also made a map design for the intro!

 

About that GPT...

* I asked a certain AI tool to rewrite the above as if a copywriter had written it.  (Creatives are doomed...take a look below at what it wrote!  If not, feel free to move on to the next section.) 

"Embark on an exhilarating adventure with Indy as your guide! Your quest begins with a prompt from the legendary explorer himself, asking for your help to retrieve the coveted golden fertility idol from a perilous temple/cavern. Traverse ancient ruins, navigate through dark caves, and overcome obstacles to reach your goal.

As you ascend a flight of ancient ruins, you'll encounter a massive circular wall blocking your way. But fear not! You'll quickly realize that the missing center stone can trigger the wall to open, revealing the path forward.

Next, you'll face a daunting ravine that stands between you and the idol. Think fast and seize a large plank of wood to bridge the gap and safely cross to the other side, avoiding a treacherous pitfall.

But the challenges don't end there! As you approach the golden idol, a new set of obstacles emerges. Watch your step! One wrong move on the floor tiles triggers a sinister set of spikes that spring from the ground. Quick reflexes and careful footing are crucial to avoid a perilous fate.

Finally, after overcoming all obstacles, you'll reach the end of the temple and lay hands on the golden idol. Your mission accomplished, you can now proudly deliver it to its rightful place in the museum, basking in the glory of your adventurous triumph!" 

Modeling the Fertility Idol:




Code

Code to trigger the circular wall opening animation after it is triggered by a specific gameobject:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Trigger_CircleWall : MonoBehaviour
{
        CharacterController controller;
    public Animator anim;
   
    //public GameObject Spears;
    // Start is called before the first frame update
    void Start()
    {
         controller=this.gameObject.GetComponent<CharacterController>();
    }

    void OnTriggerEnter(Collider collision){
        Debug.Log(collision.gameObject.name);
                   if(collision.gameObject.name=="Puzzle_Piece_OG"){
                    //Spears.SetActive(true);
                    anim.Play("Circular_Door_Open_Anim");
                   }
    }
}


Code to trigger the Spikes:

I needed the spikes to be hidden until triggered by the XR camera, in which case the set active was turned on, and the animation plays on awake.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Trigger_Spear : MonoBehaviour
{
        CharacterController controller;
    //public Animator anim;
    public GameObject Spears;
    // Start is called before the first frame update
    void Start()
    {
         controller=this.gameObject.GetComponent<CharacterController>();
    }

    void OnTriggerEnter(Collider collision){
        Debug.Log(collision.gameObject.name);
                   if(collision.gameObject.name=="XR Origin"){
                    Spears.SetActive(true);
                    //anim.Play("UP_Anim_Basic_Spear");
                   }
    }
}

Code to trigger the roof to descend and for sharp spikes to come through the roof.

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Trigger_Wall : MonoBehaviour
{
        CharacterController controller;
    public Animator anim;
    public Animator Spikes;
    public Animator Roof;
    //public GameObject Spears;
    // Start is called before the first frame update
    void Start()
    {
         controller=this.gameObject.GetComponent<CharacterController>();
    }

    void OnTriggerEnter(Collider collision){
        Debug.Log(collision.gameObject.name);
                   if(collision.gameObject.name=="XR Origin"){
                    //Spears.SetActive(true);
                    anim.Play("Wall_Down_Anim");
                    Spikes.Play("Spikes_Roof_Anim");
                    Roof.Play("Roof_Down_Anim");
                   }
    }
}


The assets involved:

3D Adventure Game Kit: I was able to pull a lot of nice rockwork and vines from here.

Weapons (Used for spikes!)

Campfires and Torches Model: I used one of the torches, but I had to fix the fire and smoke textures. 

Wood texture for the plank  

 Ancient Jungle Temple: Sculpture used