Any views expressed within media held on this service are those of the contributors, should not be taken as approved or endorsed by the University, and do not necessarily reflect the views of the University in respect of any particular issue.

VR Virtual interaction

Camera Raise

To make the camera move up by clicking the A button on the controller, I use the OVRInput class to detect button presses on the Oculus Touch controller. Specifically,use the OVRInput.GetDown(OVRInput.Button.One) method to check if the A button has been pressed.

To move the object, I check for user input using either the KeyCode.E or OVRInput.Button.One keys being pressed, and then use the transform.Translate method to move the object upward using the Vector3.up direction multiplied by a speed factor (cameraSpeedSeed) and Time.deltaTime. Once the object has reached a certain height (50), the code sets the firstScene boolean to false and the secondScene boolean to true, then starts a coroutine called “SecondScene”. In the second scene, the player’s position, direction, and rotation are stored in their respective variables for later use.

Day and night changes:

Two scripts were set up for day and night changes.
One controls the movement of the sun to create changes in the shadows. The CalculateTimeDifference(sunriseTime, sunsetTime) method is used to set the sunrise and sunset times. However, it was observed that the changes in the shadows were not very noticeable.

Another script was written to switch between three different skyboxes for morning, noon, and evening. The time was set to automatically switch every 15 seconds using the if (Time.time % 10 < Time.deltaTime) statement in the Update function.

           

Seasonal Changes:

Implemented seasonal changes for tree materials using Unity’s URP. I used color variations in the material to represent the four seasons. Smooth automatic switching between four material textures was achieved by setting a timer to control the interval between season changes. In each Update function, the timer was incremented by the time of the last frame, and the time elapsed since the last season change was checked against the set interval. If the time elapsed exceeded the interval, a season change was triggered. To smoothly transition between materials, the Lerp function was used. However, a problem occurred where the shader material for the tree trunk and leaves changed together. This was resolved by separating the material textures for the trunk and leaves in separate nodes.

Animal Interaction:

Controlling animal animation. Two methods have been attempted, one using scripts and the other using animation clips.
There were some difficulties with the Animator at the beginning because the imported animal model came with bone animations, such as a bird flapping its wings. However, I needed to add a movement clip to the bird and play both animations simultaneously in the Animator. To achieve this, I created an empty Animation Clip as a parent and dragged the two child Animation Clips into the empty Animation Clip. Then, I used a Blend Tree to control the bird playing both animations at the same time in the Animator Controller.
The other method involved triggering movement through coding, by setting a target point with “targetPosition = new Vector3(Random.Range(-5f, 5f), Random.Range(-3f, 3f), 0f);” and calculating the distance from the animal to the target point with “distance = Vector3.Distance(transform.position, targetPosition);”. This allowed for automatic animation control.

Timeline Events

Under the guidance of the professor, we attempted to implement the multitasking switching function using coroutines. Three coroutine functions were defined: SecondScene, ThirdScene, and FourthScene, which were used to switch between different scenes at different time intervals.

The first coroutine function, SecondScene, waits for 5 seconds, calculates a new position spawnPosition, and instantiates a game object birdPrefab at this position. It then waits for another 20 seconds, sets the variable secondScene to false, and ends the bird animation. Finally, it starts another coroutine function, ThirdScene.
The second coroutine function, ThirdScene, waits for 1 second, then instantiates a game object rainPrefab, enables the particle system for rain, and plays a sound effect. It then waits for 10 seconds, destroys the rain object, stops the sound effect, and starts another coroutine function, FourthScene.
The third coroutine function, FourthScene, is the scene for finding fire. It sets multiple fire particles and activates each game object in the fires array sequentially using a script, while playing a sound effect. Each fire object waits for 2 seconds, and then they are destroyed. Finally, the sound effect is stopped, and another scene, trunk, is loaded.

Leave a Reply

css.php

Report this page

To report inappropriate content on this page, please use the form below. Upon receiving your report, we will be in touch as per the Take Down Policy of the service.

Please note that personal data collected through this form is used and stored for the purposes of processing this report and communication with you.

If you are unable to report a concern about content via this form please contact the Service Owner.

Please enter an email address you wish to be contacted on. Please describe the unacceptable content in sufficient detail to allow us to locate it, and why you consider it to be unacceptable.
By submitting this report, you accept that it is accurate and that fraudulent or nuisance complaints may result in action by the University.

  Cancel