top of page
Puzzles and Interactions

Some of the things that make a game enjoyable are its puzzles and the world, especially when you can interact with it.

The most important part of creating an interactive world in virtual reality is a ray tracking script that casts a ray and creates a ball where it collides with something.

Interaction.PNG

The script instantiates a prefab where the ray collides with an object. In my case that prefab has a triggered sphere collider and is tagged as RedBall.

Please note that this script was created by following a tutorial created by Dr Ian Dunwell.

The RedBall is used in a lot of situations, such as triggering animations picking up objects and interacting with the world.

In the next example you will see the redball in action, triggering an animation that would lift an object off the ground revealing a hidden object.

Animation.PNG

The script is quite simple, it checks if the ball collides with the object and sets active a text and then if it gets a click input from the mouse, it will run the animation.

Another interaction would be a script that opens a dialogue window between the player and the disabled tutorial robot.

Dialogue.PNG

Other interaction is found inside the puzzle in the generator room.

Crank1.PNG
HeatControl.PNG

The way i created the generator puzzle is a bit tricky. There is a heat controller script that keeps five static Boolean values. The values can be either true or false. When they are a specific combination, they will deactivate a game object that blocks the way of the player.

This script works hand in hand with the 5 cranks scripts. Those scripts change the value of the Booleans in the heatcontroller and also output a in-world text that confirms whether or not the crank is on or of. The five scripts are the same except the fact that the handle the input for different cranks.

Generator1.PNG
Generator2.PNG

This script handles the first ending, the bad one. It checks if the player has the three objects he needs in his inventory, by checking the items in the list that was presented at the inventory section and then allows him to build the ship engine. After that it will reset all the static variables and run a cut scene, that is an animation in another scene.

The same goes for the second ending, the only difference being that this one disables the fps controller and plays an animation.

MinnieShip1.PNG
MinnieShip2.PNG

Another important interaction is the one between the player and the elevator. When the player enters the collider that is on the elevator and if he presses the key "E" he will be transported either to 1st floor or 2nd floor.

Elevator.PNG

Another important interaction is inside the inventory of the player, where he can find a button that can be pressed at a number of seconds and that will add some health to the ship.

FixShip.PNG

It has a timer that is activated when the button is pressed and when it finishes it will allow the button to be pressed again. The button also has attached to it a box collider and a rigidbody.

The same sort of method was used in the play script, a script that is attached to the play button in the main menu, and that once pressed it will load the first scene in the game.

play.PNG

Another very important interaction between the player and the world is the ability of the player to cut some debree objects using the saw tool.

DebreeDestroy1.PNG
DebreeDestroy2.PNG

The script handles the "health" of the object that is getting cut, also disabling some of the parts of the object to give it sort of a progress and it also disables/ enables the particle emitter known as "part".

Other Interactions are the small tutorials. Those tutorials appear only once, the first time when a player interacts with a crack or with a blocker.

WeldTutorial.PNG
SawTutorial.PNG
bottom of page