Object Hierarchy and Scripts in Unity

If you’re a traditional developer, Unity is more than a bit odd. The constructs, for the most part, make sense, but they require that you contort your thinking a bit. In this post, I’m going to walk through object hierarchy, scripting, and reuse.

Game Objects

Everything in Unity is built up from the concept of a game object. A game object is a connection for components. Every game object will have either a Transform or a Rect Transform component associated with it. 3D objects have a Transform – which is a 3D transformation containing the location, rotation, and scale, along X, Y, and Z dimensions. 2D objects have Rect Transform components, which are designed to work with 2D objects even if they exist in a 3D space. Game objects with a Transform don’t fundamentally have a size. Their size is driven by the other components that are attached to the game object.

Game objects can be organized in a hierarchy. This is useful when you want the objects to operate as a unit, as we’ll see as we build out the rotator script and demonstrate its use to create a cluster of directional lights. However, for performance reasons, deep nesting of game objects is discouraged. Largely, this is because some operations are recursive, and a large number of recursive operations can drop the frame rate of the solution unacceptably low. (Below about 60 frames per second.)

Frame of Reference

In the post Creating A Spinning Cube with Unity and MRTK, I created a single object – called Nexus – which had child objects of lights. To Nexus, we attached a rotation script and rotated Nexus. This caused all the lights associated with Nexus to rotate and move. We were able to set the context of the lights local to Nexus, and whatever Nexus did, the light objects would do as well.

This illustrates why we need to be careful with object hierarchy inside of Unity. When we do one operation, we’re impacting seven objects inside the hierarchy. The greater the depth of the hierarchy and the more objects, the more things need to be manipulated – or at least checked – for a single operation.

Scripts and Game Objects

In Unity, scripts are C# code that is associated with a game object. Placing a script in the project does nothing until it’s connected to an instance of a game object. Game objects themselves can be almost anything – including nothing but a container with a Transform component, like the Nexus game object. When we added the script as a component of the game object, we connected the script and told Unity to instantiate the class and connect it to the game object that we added it to.

Including public properties in the script allowed us to set those properties in the editor and ultimately have one script act on multiple objects in different ways. Unity automatically tooled our Camel case names and added spaces before the capital letters to make it more readable. It also provided an editor for the complex Vector3 object. This makes it easy to create scripts that are reusable across objects and for different purposes.

HR Uprising Episode 66: Avoiding Burnout – Masterclass

A week ago, I joined Lucinda Carney on the HR Uprising Podcast to give a special masterclass on burnout – and how you can avoid it. In it, I discuss ways to identify the root causes of burnout. I talk about what our personal agency is in the context of burnout and what fills or drains our personal agency bathtub. I also review the two components of stress (the stressor itself and our assessment of the stressor) and strategies that can help you avoid burnout.

You can listen to the full podcast here: https://hruprising.com/avoiding-burnout-masterclass-with-robert-bogue/

Creating the Spinning Cube Program with Unity and MRTK

In this post, I’m going to walk through the creation of a spinning cube program in Unity. For this demo, we’ll build it with the Mixed Reality Tool Kit (MRTK) and set it up so that you could deploy it to a HoloLens 2. A spinning cube is sort of the 3D equivalent of “Hello World.” So, it’s a good starting point for developing with Unity and using MRTK.

I’m going to use this as an opportunity to explain script reuse and how you can use the same script with parameters with multiple objects. I’m also going to use this as an opportunity to explain basic game object hierarchy and how you can rotate a parent object to cause all the child objects to rotate as well. Finally, we’ll use this project to show off the MRTK orbital component that will allow us to keep objects in the center of view.

To make this project work, we’re going to create one cube object, an empty game object, six directional lights, and one rotator script. We’re going to use the lights to change the appearance of our cube as it spins. The standard material for the cube will reflect the light if we change the colors. By using the orbital component in MRTK, we’ll give the user a way to inspect the object from different angles, even while things are rotating.

Getting the Project Ready

Rather than replicating the steps necessary to create a new project and configure it with MRTK and set it set to deploy to the HoloLens 2, I’m going to refer you to the first 16 steps in the post Building a Unity Project with Speech Recognition using MRTK for a HoloLens 2. The only change we’ll make is that we’ll name the project SpinningCube, since that’s what we’re doing.

Adding the Cube and Lights

[Note: We’ve intentionally continued the numbering throughout the entire post so that we can refer to unique steps in the post.]

Let’s get started by adding our cube and the lights.

  1. Click the GameObject menu and click the Create Empty option.

  2. Right-click on the GameObject in the menu, select the Rename option, then type a new name called Nexus.

  3. Click and hold the Directional Light object and drag it into (under) the Nexus object.

  4. Right-click the Directional Light and click the Rename option in the menu. Enter the name Red Light for the light.
  5. With the Red Light selected, go to Inspector panel, and enter the position of X 0, Y 10, Z 5 and a rotation of X 90, Y 0, Z 0. This points the light to a spot 5 meters ahead of the visible camera.

  6. In the light component, double-click the Color option. In the dialog that appears, set the Red (R) to 255, Green (G) to 0, Blue (B) to 0, and make sure that Alpha (A) is set to 255.

  7. Right-click the Red Light object and select Duplicate from the menu. Repeat this process four more times until you have five lights under your Nexus object.
  8. Using the preceding steps (4-7) and following table, reconfigure the lights you duplicated under Nexus:
     

    Position

    Rotation

    Color

    Name

    X

    Y

    Z

    X

    Y

    Z

    R

    G

    B

    Blue Light 10 0 5 0 -90 0 0 0 255
    Yellow Light -10 0 5 0 90 0 255 255 0
    Purple Light 0 0 10 0 -180 0 255 0 255
    Cyan Light 0 0 0 0 0 0 0 255 255
    Green Light 0 -10 5 -90 0 0 0 255 0
  9. Create the cube by clicking GameObject, 3D Object, Cube from the menu.

You’ll notice that the cube appears to have a different color on each side. If you check the material for the cube, you’ll see that the material is a neutral color. The colors that appear on the cube are coming from the different lights we added to the scene.

Adding the Orbital Component

One way to make it possible to see what we’ve done is to add an Orbital component that comes as a part of MRTK. We can use this to keep an object (or collection of objects) in front of the camera. Let’s add the Orbital component to our cube and to our lights separately. If we weren’t going to rotate the cube separate from the lights later, we could move the cube under our Nexus object, but since we want different rotations, we’re going to keep these two objects separate.

  1. In the Hierarchy, select the object we named Nexus.

  2. In the bottom of the Inspector pane, click the Add Component button. Start typing orbital and select Orbital when it appears.
  3. Notice that Unity added a SolverHandle and set it to Head in addition to the Orbital component. The SolverHandle is necessary so Orbital knows what it’s tracking. In this case, Head is the same as the primary camera.
  4. In the Orbital component, click the Orient Type dropdown and select Unmodified. This will prevent Orbital from trying to orient the object.
  5. Also, in the Orbital component, change the Local offset’s Y value to zero and the Z value to 2– so the resulting offset is X 0, Y 0, and Z of 2.
  6. Select the Cube object in the hierarchy and repeat steps 11-14.

Testing the App

Now we can test our solution. We can press the Play button to see our cube floating in front of us in the game tab. If we move in the play mode, we can see different sides of our cube. You can right-click in the game window and move your mouse to move around in the 3D game space.

That’s a good start, but let’s create a reusable rotation script.

Adding the Rotator Script

We want to setup two different objects to rotate. First, we want to rotate the cube that we added to the scene, but second, we want to rotate the lights in the scene differently. To do that, we’re going to create a rotate script, and in the next section, we’ll attach the script to objects and configure them.

The script will define two public fields – RotationXYZ and RotationRateScale. The first will set the rotation along each axis, and the second will allow us to scale the rotation speed overall without modifying the individual variables. The only other part of this script will in Update() and will use the Transform component’s Rotate method to rotate the object.

Let’s get started.

  1. In the menu, click Assets, Create, and finally C# Script.

  2. Name the script Rotator and press Enter.
  3. Close the MRTK Project Configurator dialog, then double-click your Rotator script to launch Visual Studio.
  4. Inside the top of the class, define the two public variables:
    public Vector3 RotationXYZ = new Vector3(1.0f, 2.0f, 3.0f);
    public float RotationRateScale = 1.0f;
  5. Inside the Update method, add the following code to rotate the object:
    float totalScale = Time.deltaTime * RotationRateScale;
    Vector3 v3 = new Vector3(RotationXYZ.x * totalScale, RotationXYZ.y * totalScale, RotationXYZ.z * totalScale);
    gameObject.transform.Rotate(v3);
  6. Click the Save All button in the ribbon to save your changes to the script.

The script initializes the rotation to a default rotation of X 1, Y 2, Z 3 degrees per second and an overall scale of 1. The update method uses Time.deltaTime – a global property to determine what fraction of a second has occurred since the last call to Update(). This is the way that we can scale the degree of the rotation based on the framerate that’s happening inside of Unity. The code gets the total scaling for the rotation by multiplying our overall rate scale times deltaTime. Then a new Vector3 is created with the rotation needed, and this is applied via the transform component’s rotate method.

Attaching the Rotator Script to the Cube and the Nexus

Our rotator script is fully functional – but it’s not connected to anything. We connect it to our cube and to our Nexus object by selecting the object and dragging the script into a blank spot in the hierarchy.

  1. Start by clearing the MRTK Project configurator by clicking the X in the upper right-hand corner.
  2. Select the Cube object in the hierarchy.
  3. Drag the Rotator script into a gap between components in the inspector pane and release.
  4. Select the Nexus object and repeat step 24.
  5. In the Inspector panel, in the Rotator component, change the Rotation Rate Scale to 10.

By setting the rotation scale to 10 for the lights, you’re causing the lights and the cube to rotate at different rates, and therefore the surfaces of the cube will turn different colors as different lights start acting on them.

Viewing the Final Solution

To view the final solution, simply press the Play button and watch how the Game tab shows your cube spinning – and with the lights spinning at different rates.

You can now go to Nexus and change the rate – or the individual rotation values for each of the X, Y, and Z components to see different spinning effects. You can also navigate around the scene and the cube and lights will follow you. You can use this to look at different parts of the cube in the scene.

If you want to get the completed project, it’s available at https://github.com/rlbogue/UnityPublic/tree/master/SpinningCube

Book Review-Reading the Room: Group Dynamics for Coaches and Leaders

Have you ever had that bewildering moment when you’re in a conversation and you suddenly realize that you have no idea what the conversation is about? You’re going along, disagreeing but still conversing, until you reach the moment when you’re aware that you’re not talking about the same thing as the other person, and you wonder exactly how you got here. Reading the Room: Group Dynamics for Coaches and Leaders is designed to help you better understand the dynamics that are in play in a room and be able to observe and react to them better.

I was first introduced to David Kantor’s work via Bill Issacs’ work, Dialogue. The revelation that was shared was that people speak from three different points of view: power, meaning, and feeling (affect). When people are in the same conversation but speaking from these radically different perspectives, it’s often as if the people in the conversation are talking past each other, unable to even hear, much less process, what the other person is saying. As I was preparing the Confident Change Management course, I decided that I needed to dig a bit deeper into Kantor’s work. I’m glad I did.

Operating Systems

When a computer boots up, it starts the operating system, and thereafter it just becomes a part of the way the computer works. It’s largely unnoticed except when you go to launch a new program. Yet all the time, the operating system is coordinating and shaping your experience with the computer. The operating systems that we use in life are the same. They’re the default assumptions, way of working, and underground of our consciousness. Kantor explains that there are three operating system types:

  • Closed – We believe we have all the answers, and we must share them with the world so they can execute our great ideas.
  • Open – Collectively, we know more than anyone can know. We just need to bring everyone together in a conversation (or dialogue) to expose it.
  • Random – Insights come but only if we’re willing to ignore the structure and work through problems in the way that feels the most natural.

None of these are good or bad – just good or bad for the environment they’re used in.

Communications Domains

The power, meaning, and feeling (affect) I mentioned above make up the communication domain. Some people are concerned with the movement of power, some with the meaning of it all, and some with how it will make people feel. What is important here, as it was with operating systems, is that people don’t realize this is happening.

They have a style of communication that is their preferred style. It is the one they’ll fall back to most often, particularly when stressed. Communicating with people speaking in a different domain can be as foreign as speaking with someone in a foreign language. It takes great concentration and focus to understand what the other person is saying.

Action Modes

The third part of the model (or third layer, if you’d prefer) is the way that someone is responding in a conversation. Here, most of us have more flexibility, but still tend towards one of the following approaches:

  • Move – A drive towards action
  • Follow – Support of a previous mode
  • Oppose – To move against the proposed move either by stopping or moving in another direction.
  • Bystand – Watch what is happening and observe, but don’t outwardly act.

Kantor says that people can only take one of these four stances in a conversation. I disagree, because I think it underplays the need for curiosity, inquiry, and understanding. Whether you want to use Motivational Interviewing, The Ethnographic Interview, or some other guide to understanding the position of another person, I believe that it’s essential to communication. So, I support the attempt to identify archetypical moves, I’m not sure this is the comprehensive list.

Dialogue Mapping exposes the IBIS model of dialogue mapping that includes questions, ideas, pros, and cons. Fundamental to this approach is the question, which is both the central theme for discussion and a way that the problem can be clarified.

Seeing Ghosts

A key, and appropriate, observation of Kantor’s is that sometimes the conversations aren’t about the conversation happening in the room at that time but are instead ghosts left over from our childhood, the stories we told ourselves, and the patterns we were left with. We see reasons to trust where none should be given. (See Trust => Vulnerability => Intimacy, Revised for more on trust.)

Sometimes the challenge with the conversation that’s going on has nothing to do with the here and now and instead is some remnant of some experience that was had a long time ago, and it’s left an indelible mark on our psyche, a permanent fixture that we’ll spend the rest of our lives covering up or addressing.

In the Shadows

Shadows are places where the ghosts live. They’re the places that people don’t want to go. They’re spooky, scary, and frightening. However, the greatest risk to our conversations isn’t in not learning a new skill. The greatest risk is in not being able to address those things that hold us back.

Whether these barriers to success surface as ghosts or as undesirable consequences of our default operating modes, learning to shine light in the shadows of our psyche – and then having the discipline to do it – makes us more complete as humans, coworkers, and leaders. Unlike many popular psychology books today, Kantor invites us into the space of our weaknesses, so that we can discover them more fully and learn to address the most grievous issues that are causing us harm.

Courteous Compliance

In Radical Candor, Kim Scott has a place called “ruinous empathy,” where there’s caring for the other person but no willingness or ability to challenge directly. Kantor calls this “courteous compliance,” when you disagree with the conversation but aren’t willing to speak up to have your voice heard. Kantor explains that we need to have the other voices to test and check our perspectives. It’s the silence of dissenting voices that can prove disastrous to the person and to the organization. (See The Difference for more on being inclusive of all voices.)

Control

Often in organizations, you see compensating systems. These are systems with the purpose of limiting the negative effects of other individuals. Instead of confronting the person directly about the problem, you’re faced with a system designed to limit the limitation of a leader or group. The system might take the form of an additional review meeting, an extra sign off, or additional activities, but ultimately the goal is to prevent the negative consequences from happening again.

The problem with these systems is that they are necessarily both wasteful and incomplete. They’re wasteful, because if you could only correct the root problem – or even create a higher awareness – the system wouldn’t need to exist. They’re incomplete in the fact that they’ll never cover every possible situation.

Chaos

Organizations exist through their ability to keep the chaos of the market and the world on the outside. They resist change, because it’s the status quo that keeps the organization together. People with random operating systems are a threat to the very nature of the organization. They’re called disruptors, and there’s a reason. They disrupt the carefully crafted control of the organization and replace it with just a little chaos.

Organizations resist the chaos that those with a random operating systems bring only to often find themselves unresponsive to the broader world until it’s too late.

Model Building

Kantor continues with a conversation of model building. That is, building a way that the organization will function – a leadership model. Though he uses different terms, it’s the same following, fluent, detaching approach that I’ve discussed before that is the heart of the apprentice, journeyman, master trades model. (See Presentation Zen, The Heretics Guide to Management, and Story Genius for other places where it’s occurred and Apprentice, Journeyman, Master for a core conversation about the progression.)

He uses the words imitation, constraint, and autonomy for the progression, but the concepts are nearly identical to the following, fluent, and detaching that are more commonly used.

Perhaps it’s because I’ve been through the progression myself that I don’t get locked up with Kantor’s approach to everything. However, I feel as if I’ve gained some appreciation and skills for Reading the Room through reading the book.

The 6 Figure Developer Episode 155: Burnout and Change Management

I recently had an opportunity to join John Callaway on his podcast, The 6 Figure Developer. In this episode, we spend some time discussing the research for Extinguish Burnout. I explain how, in the classical definition of exhaustion, cynicism, and inefficacy, it’s inefficacy that seems to be key to heading toward (or getting out of) burnout. I also discuss the Bathtub Model, which describes our capacity for personal agency, the factors that pour into it, and the demands that draw from it.

We then move onto a brief conversation on change management. I talk about why change management is important even in the realm of technology and review the work that went into the change management course, including the 101 books referenced in the course and the custom programs developed in the process.

You can listen to the full podcast by going here: https://6figuredev.com/podcast/episode-155-burnout-change-mgmt-with-rob-bogue/

Now Available: A One Click Link to Start a OneDrive Sync for a SharePoint Library White Paper

Many companies are transitioning from file shares to SharePoint, especially with the ability to collaborate on files in real time from anywhere. During this transition, it can be useful to migrate the files to SharePoint, then set up OneDrive to synchronize libraries to the local machine. The files end up in a slightly different place, but it’s still familiar to users.

The problem is that, out of the box, there’s no way to get a one-click link to start the synchronization process. That’s why we developed this white paper, “A One Click Link to Start a OneDrive Sync for a SharePoint Library,” with a corresponding web part. We walk you through the little bit of setup it takes to get a one-click link to synchronize a library.

You can get the white paper right now by clicking the link below.

Get the One Click OneDrive Sync white paper

The Cold War Experience

Vacations for us are often about the experiences. It’s about sharing with our now adult children what things were like in the past or what they are like in the present for different people. Our recent vacation was anchored around “The Bunker.” It’s a relic of the Cold War situated in the Allegheny mountains, and it’s a secret that was kept successfully for 30 years. As we went through the facility, I realized that our children couldn’t connect the experience to what it was like in the Cold War. This post is an attempt to weave together enough context that everyone can understand what might make the government secretly pour 50,000 tons of concrete into a facility that wasn’t designed to sustain a direct nuclear attack.

From Allies to Enemies

The transition from allies in World War II to enemies in the Cold War was predictable. The United States was capitalistic and independent. The Soviet Union was based in Marxist ideas of communism, central planning, and obedience. From an ideological standpoint, it would have been hard to draw to more divisive positions. With a common enemy, we could side-step our ideological differences, but without that, we would eventually begin to vilify the other. We’d find a new enemy to hate where we once saw an ally.

This presented a nuclear problem. The United States initiated the world to the atomic age with the bombings in Hiroshima and Nagasaki that ended World War II in the Pacific. Shortly thereafter, Russia developed their own atomic bombs; after that, both sides developed even more powerful hydrogen bombs. Suddenly, there was enough power to cause major havoc.

The Escalation

The Cold War escalated through numerous microaggressions on each side. A game of nuclear one-upmanship started and just kept going. While we know now that capitalism was more effective economically than the Lennon-Marxist approach that the Soviet Union was based on, back then, both sides were posturing to have the upper hand. The world agrees that the closest that we ever came to nuclear war was the discovery of missiles in Cuba.

The United States had medium range ballistic missiles deployed in Turkey – a North Atlantic Treaty Organization (NATO) country – that would reach Moscow. It was about 1,200 miles – the same distance between Cuba and Washington, DC. However, for the United States and John F. Kennedy, it felt more personal. The event was called the Cuban Missile Crisis, and it’s cataloged in One Minute to Midnight (among other books). It’s the closest we ever came to activating the project that eventually became named “Greek Island.”

Escaping Fallout

The Soviet intercontinental ballistic missiles of the time weren’t very accurate, and, little did we know, there weren’t very many of them. However, the threat of attack was real. The Soviets could launch an attack that would require the evacuation of Washington, DC, and there would be at least some warning of the attack. There was no question in anyone’s mind that Washington, DC was on the “hot list” for the Soviet Union. It was expected that Washington, DC would see a nuclear missile. The idea was that if Congress could survive the initial attack, they’d need a place to go to continue the operation of the government – and that was “Greek Island.”

The government needed a facility that was close enough to Washington, DC to be reachable, yet far enough away that the fallout from the radiation wouldn’t be a problem. The result was a small town in the middle of the Allegheny mountains, 240 miles from Washington and relatively protected from airborne attack – the kind of attack assumed to be the most likely way that a secondary location might be targeted.

Duck and Cover

Meanwhile, school students were being taught to duck and cover under their desks in the event of an air raid. Somehow, the London bombings from World War II had become lodged in the hearts and minds of the planners and was coupled with the fact that we used planes to deliver our atomic arsenal on Japan. The assumption was that, if war ever did break out with the Soviet Union, it would come in the form of an aerial attack.

The student desks at the time were neither impervious to conventional bombs nor nuclear ones, but somehow these drills helped reinforce both the ability to take some action and a trust in a government that was there to protect you.

At the same time, fallout and bomb shelters were being constructed by individuals of means and communities of concerned citizens. The threat of bombings and nuclear war was perceived to be eminent for decades. The argument was that one of the skirmishes that the United States and The Soviet Union had been supporting would eventually spill over into an all-out attack, and everyone wanted to be ready for it.

While the fallout and bomb shelter business may have been commercially profitable for some construction companies, relatively few community shelters were developed and stocked. However, it reinforced the idea that the country had a plan and we were ready.

The Greenbrier

Located in the Allegheny mountains about 240 miles away from Washington, DC, accessible by railroad, car, and airplane, The Greenbrier hotel was an ideal place for Congress to go in the event of a nuclear emergency. However, the hotel’s luxurious amenities weren’t what Congress was going to need. They needed something a bit more primitive but much more concealed and self-contained. They needed a bunker that could protect Congress from the fallout of a nuclear war even if the facility couldn’t sustain a direct hit.

The facility was owned by the Chesapeake & Ohio Railway, an organization that the government was already in the habit of writing large checks to. Adding some additional funding for a secret underground bunker wouldn’t be that difficult.

The Construction

You can’t hide the construction of a bunker, even in the late 1950s. People were going to know that something was up. So, a cover story was created. The cover story was the expansion of the hotel with subterranean event space. The construction was divided up to different people with the idea that, if the work were divided sufficiently, few people would be able to put together the true scope. Those who worked more closely were given “the talk” about national security, secrecy, and ultimately a non-disclosure agreement to sign.

Construction was completed in 1962 – the same year of the Cuban Missile Crisis and the only time in its history that the bunker was almost used.

Operational Status

For 30 years, until its existence was revealed in 1992, the bunker was kept operational ready by a government contractor, Forsythe, whose cover story was that they would repair the TVs and communications at The Greenbrier. They did this in addition to their real duties maintaining the infrastructure that would hum to life in the event that a confidential lease was activated.

With a phone call indicating that the government was activating their lease, The Greenbrier would provide three days’ worth of food to supplement the non-perishable and semi-perishable food that would already be in the facility – stocked by government contractors. In the hours that followed, members of both houses of Congress would arrive, and once the Congressmen and their staff had arrived, the doors would be sealed, and the bunker would be isolated except for communications.

The Reveal

The secret was safe for 30 years, until, in 1992, the existence was revealed in The Washington Post. Arguments are still had today about whether its disclosure was a good or bad thing. The original mission as a Cold War bunker for Congress no longer held. First, attacks had warning times of minutes, not hours any longer. Second, in December of 1991, the Soviet Union had officially fallen apart. Russia and several other states were going to have to go it on their own. The Russian threat was gone.

The details of Project Greek Island were so secret that even the very members of Congress, who were to be protected in the bunker, were unaware of its existence. Suddenly, what was a secret to even those whom it was designed to protect was revealed, and because its safety was now compromised, it was decommissioned.

The Greenbrier operates tours now, taking people to places to parts of the bunker that remained hidden for 30 years. However, you’ll need to leave your camera and cell phones behind. No electronic devices are allowed – but not because of the government, at least not directly.

CSX-IP

We were told on the tour that the reason we can’t have cameras, phones, or any electronic devices was because of the company operating in the space, CSX-IP. They were described as a company that secures data for Fortune 500 companies. However, there are some oddities in the story that just don’t add-up.

The C & O Railway, which owned The Greenbrier, was gobbled up by the rail giant, CSX. CSX-IP makes some sense in that they were some data spin-off or subsidiary of CSX. Except the official paperwork files with the state of Florida lists CSC as the corporate parent. CSC eventually became DXC. DXC doesn’t list CSX-IP as a subsidiary. Neither does CSX, by the way.

So, where do their clients find them? CSX-IP doesn’t have a web site. They’re an IT company running data services for Fortune 500 – but they don’t have a calling card on the internet.

If there were a data center operating in The Greenbrier, it would justify the diesel tanks and electrical generators that are maintained. It wouldn’t justify the water tanks that are maintained as well – though that’s attributed to the culinary school that is in operation. (Which wouldn’t justify this amount of water.)

Space Saving

If you had a data center operating in the bunker, it would justify blocking off space. On the tour, we didn’t get to see much space. There were the rooms for decontamination, the cafeteria, and the meeting room for the House of Representatives – but not the meeting room for the Senate. Nor did we see any of the dormitory rooms. In short, we saw a small fraction of the space that we should have seen. No explanation was given for the huge amount of space that we weren’t seeing.

However, what’s more interesting to me is that there’s a power and cooling problem that wasn’t addressed.

Power and Cooling

The real problem with data center design is power and cooling. As computer density has gone up, so have the power and cooling requirements per square foot. So, a single rack will consume between 7kVA to 60kVA of power. The net result is an expectation of 200 watts per square foot to as much as 400 watts per square foot. Compared to an office, that would have power consumption at about 1/10th of those numbers.

All that power gets converted into heat, and that heat must be cooled by something. That’s generally done with air conditioners that have heat exchangers outside the serviced area. That’s 10 times as much cooling as initially planned – and I didn’t see anything approaching that.

Conspiracies and Psychology

Perhaps the most interesting thing about all this together is that The Bunker was designed from the outset with psychology in mind. From the blast doors hidden behind “noisy” wallpaper to discourage loitering to the colors and patterns, everything was designed to obscure what was really going on.

At the end of the day, wouldn’t it be amazing if The Bunker hadn’t really been shut down in 1992 as was officially reported? What if it were still being maintained today not for its original Cold War purposes but for purposes like protecting Congress in the event of a terrorist threat – or maybe even a global pandemic?

If you want to see for yourself, schedule a tour of The Bunker.

Building a Unity Project with Speech Recognition using MRTK for a HoloLens 2

In this post, I’m going to do a step-by-step walkthrough for building a project that will do speech recognition for a HoloLens 2. Mostly these steps are the same for anytime you want to use MRTK to recognize speech. In the few places where the settings are specific to the HoloLens 2, I’ll call out what’s specific. Let’s get started.

  1. Launch Unity Hub.

  2. Click the New button and select the version of Unity that you want to use for your project. We’re going to use 2019.4.5f1 for this walkthrough.

  3. Enter the project name and folder for your project, then click Create. We’re going to be using SpeechDemo as our project name.

  4. Once Unity has finished loading (which may take a while), go to Assets, Import Package, Custom Package…

  5. Locate the MRTK Foundation Package that you previously downloaded to your local machine and click OK. In this case, we’re using the 2.4.0 build of MRTK.

  6. When the assets list is displayed, click Import.

  7. After the assets are imported, on the MRTK Project Settings Dialog, click Apply.

  8. Close the MRTK Project Settings Dialog, then go to the Mixed Reality Toolkit menu and select the Add to Scene and Configure… option.

  9. In the File menu, go to Build Settings…

  10. Click the Add Open Scenes button to add the current open scene to the build.
  11. Change the build settings to Universal Windows Platform, and, if you’re using the HoloLens 2, set the Target Device to HoloLens and the Architecture to ARM64. For Build and Run on, select Remote Device. Click the Switch Platform button to complete the switch.

  12. After the platform is switched, the MRTK Project Settings dialog reappears. Click Apply to reapply the MRTK settings, then close the dialog.

  13. In the Build Settings dialog, click the Player Settings button in the lower left-hand corner to show the project’s player settings.
  14. Expand the Player Publishing Settings and change the package name to match the name of the project. (This prevents deployments from overwriting other projects and vice versa.)

  15. Scroll down and expand the XR Settings area of the player. Click the plus button and select Windows Mixed Reality. Doing this will allow the project to open in 3D view on a HoloLens instead of in a 2D slate.

  16. After you apply the Windows Mixed Reality settings, the MRTK Project configuration dialog reappears; just close it.
  17. In the Hierarchy, verify that the MixedReality Toolkit object is selected.

  18. In the Inspector, click the Copy & Customize button to create a copy of the profile. This is done because you cannot make changes to the provided profiles. We’ll be making copies of the main profile, the input profile, and the speech profile over the next several steps.

  19. Click Clone to create the new MRTK profile.

  20. In the Inspector tab, go to Input, then click the Clone button.

  21. In the Clone Profile dialog, click Clone.

  22. Expand the Speech section of the input profile and click the Clone button.

  23. In the Clone Profile dialog, click the Clone button.

  24. Click the Add a New Speech Command button. In the new item that appears on the bottom, enter the word hello. This is the word we’re going to use to trigger our script.

  25. Go to the Assets menu, select Create, and C# Script.
  26. If you’ve never configured Unity to use Visual Studio as the editor for scripts, you may want to do that now by going to Edit and then Preferences... (If it’s already configured, you can skip to step 27.)

  27. Go to External Tools and set External Script Editor to Visual Studio – whatever version you have. We’re using Visual Studio 2019 (Enterprise) for this demo. It is functionally the same as the community version for the purposes of this walkthrough.

  28. Double-click the NewBehaviorScript.cs that was created. Visual Studio appears with the file open.

  29. Enter the interface IMixedRealitySpeechHandler, and then right-click the squiggles and select quick actions to have Visual Studio suggest the using statement for Microsoft.MixedReality.Toolkit.Input. Click this entry or press Enter to accept the change.

  30. In the Startup() method, add the line CoreServices.InputSystem?.RegisterHandler<IMixedRealitySpeechHandler>(this); to register this script to receive events. Right-click the squiggles and select quick actions to have Visual Studio suggest the using statement for Microsoft.MixedReality.Toolkit. Click this entry or press Enter to accept the change.

  31. Add a new method to support the interface, OnSpeechKeywordRecognized() as follows:

    Public void OnSpeechKeywordRecognized(SpeechEventData eventData)

    {

    switch(eventData.Command.Keyword.ToLower())

    {

    case “hello”:

    Debug.Log(“Hello World!”);

    break;

    default:

    Debug.Log($”Unknown option {eventData.Command.Keyword}”);

    break;

    }

    }

  32. Remove the Update() method from the file as it is not used. The completed script appears below:

  33. Save the files.
  34. The MRTK Project Configuration Dialog will appear; just close it.
  35. Associate the script to the MixedReality Toolkit object in the game hierarchy by dragging it to between two components in the object in the Inspector window.

  36. Run the application and say “hello.” In the debug window, you’ll see Hello World!

    If you want to get a copy of the final project, it’s available at https://github.com/rlbogue/UnityPublic/tree/master/SpeechDemo

Book Review-One Minute to Midnight

It was the closest that the world had ever come to a global nuclear war, and it started in America’s back yard. Metaphorically speaking, it was just one minute from the end of the atomic day. The clock advanced to just one minute before midnight, a whisper from the end of the world. Then slowly, magically, it receded to a spot where both sides stepped back from the abyss and found a way towards peace. It was a peace that would start the world on a track of lower risk of mutually-assured destruction.

The time spent one minute from midnight started from October 16th, 1962, when the President of the United States, John F. Kennedy, was notified that we had aerial reconnaissance confirmation of Soviet missiles in Cuba. The Cuban Missile Crisis had begun, and it had the effect of advancing the atomic clock to One Minute to Midnight.

The Story

In brief, the Soviets had worked with Cuban leader, Fidel Castro, in a partnership that put medium-range ballistic missiles (MRBMs) on Cuban soil aimed at the United States. Castro has suffered intrusions into the Cuban state through US-sponsored incursions, most notably The Bay of Pigs. The relationship with the Soviet Union was a way of protecting himself from the US and at the same time allowed Nikita Khrushchev a way to give the US back some of what it was giving to Moscow. The US had deployed MRBMs to Turkey – roughly the same distance to Moscow as it was from Cuba to Washington, D.C.

The situation was ultimately resolved through a blockade and subsequent diplomacy, but not before having nearly two weeks of very tense moments. The missiles were removed from Cuba and the US agreed to remove the missiles from Turkey.

That’s the history lesson and the context of the book. However, in addition to the twists and turns the story takes, there’s a second story that’s told of how our world has changed and how it has stayed the same.

Communications

Perhaps the most striking observation was the change in communications from then to now. Commands relayed from Washington could take 6-8 hours to make it to the commanders of the Navy stationed in the Gulf of Mexico. Official communication to the Soviet Union could take 12 hours or more. Even before the red phone was installed to provide direct communication between the US and the Soviet Union, we had improved communications dramatically.

Today, we take for granted that we can reach out and contact anyone on the planet in a matter of minutes if not seconds. We have video calls with friends and colleagues half a world away. We expect that our messages will arrive nearly instantaneously and that everyone has access to the internet in one way or another. However, at the time, the internet wasn’t a thing. It wasn’t even a wish.

One of the major challenges for the Soviet submarine commanders was the requirement that they surface to communicate with Moscow each day. While the timing made perfect sense in conflicts centered around Moscow – midnight – it made them very vulnerable during the daylight in the Atlantic waters.

Time and Distance

Never had the Soviet Union deployed ships and troops in such quantities so far away. Simple challenges like communications seemed onerous until they needed precise time signals that were too weak to receive from Moscow. Instead, they had to accept their time signals from US sources – unbeknownst to the US army.

Intelligence

It took nearly 30 hours for the US to notice that the Soviet ships that were on their way to Cuba to turn around and start heading home – after the initial awareness that the US knew of the missiles and Khrushchev started pulling back. Still, there was a spy providing the US with lots of useful information including the technical manual for the missiles being deployed to Cuba. We also had a sophisticated (for the time) set of listening posts that made it possible to detect the location Soviet submarines without their knowledge.

Spy planes, including the U-2, were used to gather aerial reconnaissance. (See The Complete Book of the SR-71 Blackbird for more about spy planes.) Where now we have satellites orbiting to safely photograph locations of interest, back then, we had to put people at risk to gather the photographic intelligence we needed to make decisions.

What we knew was mostly wrong – particularly as it pertains to the number of nuclear warheads that were in Cuba and the troop deployment. Moreover, we had dramatically overestimated the Soviet nuclear capacity. Where we underestimated the deployment strength, we vastly overestimated the total strength.

Missiles

The crisis wasn’t really about the ability to hit the US from Cuba. The truth was, as Kennedy was aware, that you were dead whether the nuclear warhead was delivered through an intercontinental ballistic missile (ICBM) or a MRBM. Kennedy never liked the Jupiter missiles deployed to Turkey and he tried to remove them – but he was always blocked. His “ace in the hole” was the Minuteman ICBMs that were scattered throughout Montana, Wyoming, and the Dakotas. Where the Jupiter missiles were mounted above ground and took 15-30 minutes to fuel, the Minuteman missiles were in underground silos and were ready to launch “within minutes.” Their farm configuration – which spread the missile silos over large areas of sparsely populated space – made them difficult for the Soviets to wipe out in an initial attack scenario.

The missiles in Cuba were a pawn of the much larger nuclear one-upmanship that the two superpowers had been playing. It was the case of American imperialism against communist solidarity. The missiles weren’t the point – the fact that the US was being threatened was.

Cuba’s Castro

Ninety percent of Cuba was owned in some way by the United States companies or individuals before the revolution. Cuba’s liberation meant that the government ceased the assets of foreign owners for state control – and even despite this grab of economic power, the country nearly collapsed. Castro’s revolution was a success – barely – but his economy was a wreck. He was intent at doing whatever it took to ensure that the economy survived, so that the country would survive under his leadership.

He was, however, a revolutionary at heart, and as such, he was willing to go to much greater extremes than either the US or his Soviet counterparts. Where the US soldier wouldn’t tolerate poor conditions and as much as one-third of the soldiers becoming ill, this was tolerable for the Soviet troops. The Soviets had done testing on their own people with regard to the impacts of nuclear radiation. Many died as a result of their radiation exposure. Castro knew the impacts of nuclear radiation and was willing to poison his country for decades to stop an invading US force.

The Soviets brought more with them than the MRBMs. They brought tactical nuclear weapons that would wipe out an invading force – but not without rather permanent and lasting damage to the ability for Cuba to be habitable. This didn’t seem to bother either the Soviet suppliers or the Cuban Dictator, who seemed locked in his revolutionary ways and the belief that winning was all that mattered.

The Consequences of Nuclear War

Kennedy and Khrushchev were both painfully aware that there was no such thing as a limited nuclear war. They knew that once the first weapon was fired (even inadvertently), there would likely be little turning back. Where Castro seemed intent on using whatever means necessary, both leaders saw their roles in history differently. They felt like that if they stepped too far forward, there would be nothing to step back to.

What does it mean to be the victor when the world is destroyed, they wondered. Victory is hollow when it is only to survive longer before inevitable death.

Communism

The threat to democracy was communism. There was a belief that it just could be a better system of government, and the US’ democratic approach was bound to be buried by communist efficiency. Where Khrushchev made promises to crush the US economically, we now know that this was just bluster. That didn’t stop the inquiries at the time or the fear that our way of living might be changed by forces outside our control.

It’s interesting to me as I compare it to Microsoft’s response to Linux in the 1990s. Linux was a real threat to Microsoft’s Windows desktop market – only to be revealed to be a non-issue. Microsoft did lose some market share to Linux in the server market, but this was hardly as pervasive or as redefining as it was anticipated to be.

When you’re standing too close to the problem, you fail to put it into a proper perspective.

Kennedy

JFK is a hero. However, his image is much larger than the real-life person. His handling of the crisis, his push to the Moon, and his famous speeches anchored a place for him in the American psyche. Having been assassinated, he didn’t have to accept the messiness of the fall from grace. However, when you look deeper, you see parts of the man that don’t reflect the hero image.

His medical issues were a secret to me until One Minute to Midnight. I never realized all the care that he was receiving behind the scenes to remain functional. I recognize these host of problems as the result of stress and incongruency in his world – something that the doctors at the time didn’t appear to be aware of. However, the man that spoke for everyone in America was as fallible as any other man.

There are the stories that you hear about JFK and his infidelity. Marylin Monroe’s relationship with him – including the alleged sexual relationship – are well known. His string of sexual encounters was also well established. However, the relationship with his former neighbor and former wife of a senior CIA official was an aspect I had not previously been aware of.

I can only believe that these were different times for different people, when it was expected that men, particularly powerful men, would have affairs. I don’t understand it or how it would be acceptable to the wives, but it’s far from the last time that a politician – or sitting president – would have an indiscretion that the wife knew about and either condoned or concealed. (Think Bill Clinton.)

I don’t know that we’ll ever get to the same place that we were with the Cuban Missile Crisis. The Soviet Union’s attempts to keep pace with the US economy and defense spending broke it. Communism, it seems, wasn’t as great as it was made out to be. What I do remember from my history class is that those who don’t know history are doomed to repeat it – and not just the high school history class. If for no other reason than avoiding the possibility of nuclear war, perhaps it’s time to give some thought to One Minute to Midnight.

The Hidden Logic Behind Perceived Situational Safety

There are times that we feel very safe – when we are not. Similarly, there are times when we are filled with unfounded fear. It’s unfounded, because we are objectively very safe. Our actual safety and our perception of safety can be separated by many of the biases that are well known to psychologists but which few people give much thought to. However, another important factor about our feeling of safety is based on about the impact to us and our ability to respond. If we feel that the probability of any kind of loss is low and the perception of our ability to recover is high, we’ll feel safe. Conversely, if we have low self-esteem, we can be provoked into fear very easily.

Behind our feelings of safety are a complex web of factors that make us feel safe – or not. It’s this web of conflicting factors that we’ll untangle here.

The Operating Model

It’s important to understand how the emotion of fear works. It’s not simply that there’s some sort of a threat or a stressor, it’s what we believe about the stressor both in terms of probability and our ability to compensate should the stressor come to fruition. Let’s explore what we mean when we say “stressor” then talk about the aspects of our assessment that are important for both fear and anxiety.

Stressors

While the idea of stress is understood, most folks don’t have a clear picture of what a stressor is. In short, it’s anything that can cause harm to someone. The harm can be physical or psychological. The brain makes very little (if any) difference between a physical threat and a psychological threat. Most folks think of stressors as things like lions, but for humans, stressors can be losing a job, needing to pay a mortgage, etc.

Stressors can also be either real and present or predicted. Stressors need not be real in the abstract sense for them to be stressful to you. For instance, your boss may sing your praises and give you glowing performance reviews, but you may still be concerned about losing your job or getting fired. Stressors are therefore both externally generated and internally generated as the perception of a stressor.

Stressors themselves don’t generate fear or anxiety. Stressors are just the first step in the process that can lead to fear and stress – or to peace.

Assessments

To determine whether a stressor is a real problem or not, we make a series of assessments. We assess probability of occurrence. We assess the impact of the occurrence. We also assess our ability to respond should the stressor become real.

Probability of Occurrence

Stressors are either a warning that something might happen or they’re the reality that something has happened. For losing your job, it’s a prediction until it happens. For this, we estimate the likelihood. This is the first place we can make an impact in our situational safety: we can correct for biases in our estimation of the probability of the stressor occurring.

Impact

The second assessment we make is what the impact of the stressor coming to fruition may be. In the losing our job example, we may think that finding another equal or better paying job is good within a month – or we may believe that we’ll never find a job as good as the job we had. This assessment is the impact. In the first case, there may be little or no real impact; in the second, it may be a lifelong impact.

It’s important to note here that even after the threat of physical harm or the lack of food, water, and shelter are removed, there are still impacts. The impact is one of loss. We may love the mission of the organization or being able to work with good people. We may feel the loss of the organization as impactfully as we’d feel the loss of income.

Capacity to Cope

The final assessment is our capacity to cope. If we believe that we can absorb or cover for the loss in the impact, then the overall assessment of the stressor isn’t likely to cause fear, panic, or anxiety. If, on the other hand, we don’t know how to deal with the situation, the chances are that we will be afraid.

Resuming our job loss scenario, if you’ve got enough money for a year’s worth of expenses in the bank, you’ll react differently than someone who is living paycheck to paycheck and may need to be very concerned about having enough food for the family while the job search is underway.

The Math

If you were to look at this as a math problem, you’d think about the probability of getting a fear result like this:

Probability of Fear = (Stressor Probability * Stressor Impact) / Capacity to Cope

If you think that the probability or impact are low, you’ll likely not have a fear response. Similarly, if you believe you have a very large capacity to cope, you’ll only find yourself fearful when there are very high probability, high impact stressors that present themselves.

There are no units in the preceding math formula, because there are no known units to use. So, this is not a formula that you can use to reach a precise answer, it’s a guide to understand how we become fearful.

Examples

Before exploring what can be done to adjust the variables that drive our sense of situational safety, let’s review a few examples of situations and the perceived safety. This will provide background context for our more formal explanation below.

Asteroids

Consider the stressor of an asteroid hitting the Earth. In this scenario, the impact is great – potentially ending all life on the planet. Our ability to cope is very low. However, the reason that we don’t all live in a constant state of panic – besides the fact that we block it out of our minds – is that we believe the probability is infinitesimally small.

The net-net with these variables are an almost 0% chance of fear, because there’s a near zero result when the chances are so low.

Home Appliance Failure

If you own a home, there’s a certain probability that you’ll have a failure of an appliance. Let’s say that you’ve got five major appliances and that on average they fail every fifteen years. For the list, think refrigerator, stove, water heater, washer, and dryer. That means once every about three years, there will be an appliance to replace – or 33% chance per year.

The impact of a failure is a few hundred dollars. For the sake of argument, let’s just say it’s $600. That means your annual impact is about $200.

In this case, if you’ve got a “rainy day” fund or a household maintenance fund that has more than $600 in it, you can assume that you have a nearly infinite ability to cope with this sort of problem. Thus, there’s a low probability of fear. If you have less than $600 but you have enough room on your credit card, then you have an ability to cope as well, but perhaps not as large. In this scenario, you may have some probability of fear. If you have no financial reserves and are living paycheck to paycheck, you have almost no ability to cope, and therefore you have a high probability of fear.

It’s important to note that, in scenarios like these, the ego will eventually block out risks like this, because they’re too uncomfortable to live with. As a result, you’ll find people living with no financial reserves who don’t exhibit any external signs of persistent fear.

Legal Dispute

Let’s take a departure from the probability of happening and jump into a situation where the stressor has already appeared. Take, for instance, a civil lawsuit about a claim against you. Let’s say that the suit is for $100,000 – and that’s more money than you have. The probability shifts from the probability of a lawsuit to the probability of someone winning this lawsuit against you. Most attorneys are hesitant to place odds and almost never make guarantees about outcomes. They’ve experienced too many last-minute turns, unpredictable judges, and general oddity that makes them not want to place odds. That leaves you with a 50/50 split. That makes the net impact probability $50,000 – still more than you have.

In the ability to cope category, there’s a problem – and it’s more than just the potential financial impact. The bigger problem is that very few people, thankfully, have experience with this sort of a situation, and as a result, they often feel unprepared for how to proceed. This lack of understanding of the process and confidence in the attorney they just met, leads to a very low capacity for coping and therefore a high probability for fear.

Not Enough to Eat

We depart from the world of rational to irrational when we consider the concern that there will be enough to eat. Everyone has felt what it is like to be hungry. Thankfully few, but still too many, people have really had to experience what it’s like to be persistently hungry. For a lot of reasons, whatever the probability of hunger, the perceived impact is large. It’s connected with survival, and it doesn’t get much larger than that.

As a result, while most people don’t believe that there’s a real risk of going hungry, they’ll often prepare to protect themselves from it. They’ll get snack bars to put in their bags, or perhaps a bit of trail mix. They reason that they’ll be able to grab and eat it if for some reason they get hungry and can’t eat a full meal.

For many folks, particularly those that have more experience with having not had enough food during childhood, the risk of not having enough food is perceived as large. Without some sort of coping mechanisms built in – like having snack food – they’re likely to unconsciously fear that they won’t have enough food.

The Adjustments

To improve your situational safety, there are three levers we can pull on. We can adjust our perception of the probability, we can adjust the perception of the risk, or we can adjust our perception of our ability to cope.

Probability

Probability is, by its very nature, uncertain. However, as humans, we love the idea of certainty. We’ll create certainty in our minds even when no certainty exists. For instance, in the job loss scenario, we may be “certain” that we’ll lose our jobs – because our boss doesn’t like us, because of a restructuring, or because the organization folds. However, until it’s happened, it’s never certain. The first adjustment to probability is to reduce any probability from 100% until it’s already happened. It may seem like a little thing, but psychologically it forces you to evaluate things differently. It forces you to reach a more realistic guess at the probability that something will happen.

Impact

Most people believe that people who win the lottery are appreciably happier after the event – and for the infinite future forward. The truth is that lottery winners are happier for a time. However, after a few years, even a multi-million-dollar payout loses its luster. It turns out that money cannot buy happiness – though it might be able to make you a hell of a deal on a long-term lease. No impact from any event is as permanent as we expect it to be – positive or negative.

Think about your first breakup. They boyfriend or girlfriend was the one for you, and you’ll never know how to go on with your life. Except you did. You got married – you may have even gotten a divorce and remarried. The fact is that whatever the situation is, it’s not nearly as permanent as it seems when you’re standing next to it.

Ability to Cope

The final way to adjust your perception is through reconsidering your ability to cope. The more resourceful you feel about your ability to move forward personally, the less impactful the events will seem, and therefore the safer you will feel.

Too often, we fail to account for the assistance of others when coping. While some of us don’t have great support systems around us of families, friends, and communities, most of us do if we look hard enough and we’re willing to ask for assistance. When we’re assessing our situation, we should ask ourselves who we could call upon for assistance – and the likelihood that they can and will assist. If you want to change this aspect, the easiest way to do it is to ask the people around you for small things that they can do to help you – and offer to help in small ways yourself. This will increase the changes you’ll think of others support – and the likelihood that they’ll offer it.

Finally, don’t give up hope that there is some resource available to you that you don’t even know you have. There are many times when benevolence shows up even when it feels like it can’t. Keeping in mind the “miracles” in your own life and in the lives of others may be the thing that tips the scale towards perceiving that you’re safe.