Final Piece Video
These are screenshots and a video screencap of my final piece (as the real final outcome must be shown on a phone in a google cardboard headset). It shows my finished virtual reality environment, modelled on Salvador Dali's painting: The persistence of memory. It includes animated elements, with the clock hands and ocean, user input, with the ability to turn inside the environment, a surround sound soundscape that changes volume depending on where you are in the area and is slightly doppler-affected, as well as all the other elements shown in my process on this page. The video demonstrates the head tracking and gives an almost perfect depiction of what it will be like to actually use the piece as intended, and the images show an overview of the final build and what the experience looks like on a phone screen respectively.
These are screenshots and a video screencap of my final piece (as the real final outcome must be shown on a phone in a google cardboard headset). It shows my finished virtual reality environment, modelled on Salvador Dali's painting: The persistence of memory. It includes animated elements, with the clock hands and ocean, user input, with the ability to turn inside the environment, a surround sound soundscape that changes volume depending on where you are in the area and is slightly doppler-affected, as well as all the other elements shown in my process on this page. The video demonstrates the head tracking and gives an almost perfect depiction of what it will be like to actually use the piece as intended, and the images show an overview of the final build and what the experience looks like on a phone screen respectively.
These are the individual sounds that make up the soundscape of my final piece. I assigned each of the sounds to their respective objects, and edited the settings so that they are a realistic volume for the distance away you are. Using Unity's 3D sound effect, I made it so the sounds completely surround the player, realistically panning across the headphones as the user turns their head. This increases the immersive effect of the piece and acts as a subtle instruction for the user to turn around as they will be able to hear sounds coming from behind them.
Final Piece Second Build Test
After adding in all the assets, texturing them, completing the sea and sky, and adding the sound effects, I tested my piece to make sure everything was in working order. Now I just need to perfect the placement of everything, adjust the camera and lighting, and make any final tweaks it requires before the final show.
Final Piece First Build Test
This was my first rough build of my final piece, with only a few of the assets and none of the scaling or lighting worked out, just to ensure everything was in working order before I started building the final piece.
Animation Testing
This was my first rough build of my final piece, with only a few of the assets and none of the scaling or lighting worked out, just to ensure everything was in working order before I started building the final piece.
![]() |
The app logo I chose, to make it clear where my piece is on the phone, and to make it seem more professional |
Animation Testing
These are animation tests to try and get the hands on my clocks to go round smoothly and accurately. The bottom two are early attempts in blender to get it to work with keyframing alone, and the top video shows the first test after importing it into unity with an F-cycle attached.
Creating the Ocean
To create realistic looking water, I used this water texture with a reflective, bumped specular shader alongside the code below which made it look as it there were waves flowing across the surface.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scroll main texture based on time | |
var scrollSpeed : float; | |
function Update () { var offset : float = Time.time * scrollSpeed; renderer.material.SetTextureOffset ("_BumpMap", Vector2(offset,0)); } |
Photoshopped Textures
I photoshopped the original painting to give me textures that I can now UV map onto my 3D models so that they look as close to the original painting as possible
![]() |
Back flat box texture |
![]() |
Clock 3 crown texture |
![]() |
Clock 3 centre sphere texture |
![]() |
Clcok 3 hands texture |
![]() |
Clock 3 neck texture |
![]() |
Clock 3 rim and faces texture |
![]() |
Dali's face front and back textures |
![]() |
Clock 2 crown texture |
![]() |
Clock 2 hands texture |
![]() |
Clock 2 neck texture |
![]() |
Clock 2 rim and faces |
![]() |
Branch back texture |
![]() |
branch front texture |
Mountain with transparent background |
![]() |
Table texture with shadows |
![]() |
Rock 1 texture |
![]() |
Rock 2 texture |
![]() |
Floor texture |
![]() |
Ants on bottle texture |
![]() |
Bottle top texture |
![]() |
Bottle body texture |
![]() |
Bottle neck texture |
![]() |
Clock 1 centre sphere |
![]() |
Clock 1 crown |
![]() |
Clock 1 minute hand |
![]() |
Clock 1 hour hand |
![]() |
Clock 1 rim and faces |
Final Arranged Scene
These are screenshots of the scene in their final arrangement with the animated sea, all objects, and the mountain in place, in the build view (not the camera view)
![]() |
Final arrangement |
![]() |
Zoomed out view so the whole sea is visable |
Adding the Textures in Unity
After individually UV mapping the textures onto each part of each object in blender, simply dragging the texture images onto each element keeps the UV information and textures it in the correct place.
![]() |
The bottle during texturing |
![]() |
The bottle post texturing |
Building the scene
These are screenshots of my scene whilst I was building and texturing it, and the codes that are used in the final build to control the stereoscopic vision, character movement, distortion, and headtracking.
![]() |
Branch added to scene |
![]() |
Branch scaled and positioned |
![]() |
Clock two added to branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Runtime.InteropServices; | |
using System.IO; | |
using System; | |
//Dive Head Tracking | |
// copyright by Shoogee GmbH & Co. KG Refer to LICENCE.txt | |
//[ExecuteInEditMode] | |
public class OpenDiveSensor : MonoBehaviour { | |
// This is used for rotating the camera with another object | |
//for example tilting the camera while going along a racetrack or rollercoaster | |
public bool add_rotation_gameobject=false; | |
public GameObject rotation_gameobject; | |
// mouse emulation | |
public bool emulateMouseInEditor=true; | |
public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 } | |
public RotationAxes axes = RotationAxes.MouseXAndY; | |
public Texture nogyrotexture; | |
/// Offset projection for 2 cameras in VR | |
private float offset =0.0f; | |
private float max_offset=0.002f; | |
//public float max_offcenter_warp=0.1f; | |
public Camera cameraleft; | |
public Camera cameraright; | |
public float zoom=0.1f; | |
private float IPDCorrection=0.0f; | |
private float aspectRatio; | |
public float znear=0.1f; | |
public float zfar=10000.0f; | |
private float time_since_last_fullscreen=0; | |
private int is_tablet; | |
AndroidJavaObject mConfig; | |
AndroidJavaObject mWindowManager; | |
private float q0,q1,q2,q3; | |
private float m0,m1,m2; | |
Quaternion rot; | |
private bool show_gyro_error_message=false; | |
string errormessage; | |
#if UNITY_EDITOR | |
private float sensitivityX = 15F; | |
private float sensitivityY = 15F; | |
private float minimumX = -360F; | |
private float maximumX = 360F; | |
private float minimumY = -90F; | |
private float maximumY = 90F; | |
float rotationY = 0F; | |
#elif UNITY_ANDROID | |
private static AndroidJavaClass javadivepluginclass; | |
private static AndroidJavaClass javaunityplayerclass; | |
private static AndroidJavaObject currentactivity; | |
private static AndroidJavaObject javadiveplugininstance; | |
[DllImport("divesensor")] private static extern void initialize_sensors(); | |
[DllImport("divesensor")] private static extern int get_q(ref float q0,ref float q1,ref float q2,ref float q3); | |
[DllImport("divesensor")] private static extern int get_m(ref float m0,ref float m1,ref float m2); | |
[DllImport("divesensor")] private static extern int get_error(); | |
[DllImport("divesensor")] private static extern void dive_command(string command); | |
#elif UNITY_IPHONE | |
[DllImport("__Internal")] private static extern void initialize_sensors(); | |
[DllImport("__Internal")] private static extern float get_q0(); | |
[DllImport("__Internal")] private static extern float get_q1(); | |
[DllImport("__Internal")] private static extern float get_q2(); | |
[DllImport("__Internal")] private static extern float get_q3(); | |
[DllImport("__Internal")] private static extern void DiveUpdateGyroData(); | |
[DllImport("__Internal")] private static extern int get_q(ref float q0,ref float q1,ref float q2,ref float q3); | |
#endif | |
public static void divecommand(string command){ | |
#if UNITY_EDITOR | |
#elif UNITY_ANDROID | |
dive_command(command); | |
#elif UNITY_IPHONE | |
#endif | |
} | |
public static void setFullscreen(){ | |
#if UNITY_EDITOR | |
#elif UNITY_ANDROID | |
String answer; | |
answer= javadiveplugininstance.Call<string>("setFullscreen"); | |
#elif UNITY_IPHONE | |
#endif | |
return; | |
} | |
void Start () { | |
rot=Quaternion.identity; | |
// Disable screen dimming | |
Screen.sleepTimeout = SleepTimeout.NeverSleep; | |
Application.targetFrameRate = 60; | |
#if UNITY_EDITOR | |
if (rigidbody) | |
rigidbody.freezeRotation = true; | |
#elif UNITY_ANDROID | |
// Java part | |
javadivepluginclass = new AndroidJavaClass("com.shoogee.divejava.divejava") ; | |
javaunityplayerclass= new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | |
currentactivity = javaunityplayerclass.GetStatic<AndroidJavaObject>("currentActivity"); | |
javadiveplugininstance = javadivepluginclass.CallStatic<AndroidJavaObject>("instance"); | |
object[] args={currentactivity}; | |
javadiveplugininstance.Call<string>("set_activity",args); | |
initialize_sensors (); | |
String answer; | |
answer= javadiveplugininstance.Call<string>("initializeDive"); | |
answer= javadiveplugininstance.Call<string>("getDeviceType"); | |
if (answer=="Tablet"){ | |
is_tablet=1; | |
Debug.Log("Dive Unity Tablet Mode activated"); | |
} | |
else{ | |
Debug.Log("Dive Phone Mode activated "+answer); | |
} | |
answer= javadiveplugininstance.Call<string>("setFullscreen"); | |
show_gyro_error_message=true; | |
Network.logLevel = NetworkLogLevel.Full; | |
int err = get_error(); | |
if (err==0){ errormessage=""; | |
show_gyro_error_message=false; | |
} | |
if (err==1){ | |
show_gyro_error_message=true; | |
errormessage="ERROR: Dive needs a Gyroscope and your telephone has none, we are trying to go to Accelerometer compatibility mode. Dont expect too much."; | |
} | |
#elif UNITY_IPHONE | |
initialize_sensors(); | |
#endif | |
float tabletcorrection=-0.028f; | |
//is_tablet=0; | |
if (is_tablet==1) | |
{ | |
Debug.Log ("Is tablet, using tabletcorrection"); | |
IPDCorrection=tabletcorrection; | |
} | |
else | |
{ | |
IPDCorrection=IPDCorrection; | |
} | |
//setIPDCorrection(IPDCorrection); | |
} | |
void Update () { | |
aspectRatio=(Screen.height*2.0f)/Screen.width; | |
setIPDCorrection(IPDCorrection); | |
//Debug.Log ("Divecamera"+cameraleft.aspect+"1/asp "+1/cameraleft.aspect+" Screen Width/Height "+ aspectRatio); | |
#if UNITY_EDITOR | |
#elif UNITY_ANDROID | |
time_since_last_fullscreen+=Time.deltaTime; | |
if (time_since_last_fullscreen >8){ | |
setFullscreen (); | |
time_since_last_fullscreen=0; | |
} | |
get_q(ref q0,ref q1,ref q2,ref q3); | |
//get_m(ref m0,ref m1,ref m2); | |
rot.x=-q2;rot.y=q3;rot.z=-q1;rot.w=q0; | |
if (add_rotation_gameobject){ | |
transform.rotation =rotation_gameobject.transform.rotation* rot; | |
} | |
else | |
{ | |
transform.rotation = rot; | |
if (is_tablet==1)transform.rotation=rot*Quaternion.AngleAxis(90,Vector3.forward); | |
} | |
#elif UNITY_IPHONE | |
DiveUpdateGyroData(); | |
get_q(ref q0,ref q1,ref q2,ref q3); | |
rot.x=-q2; | |
rot.y=q3; | |
rot.z=-q1; | |
rot.w=q0; | |
transform.rotation = rot; | |
if (add_rotation_gameobject){ | |
transform.rotation =rotation_gameobject.transform.rotation* rot; | |
} | |
else | |
{ | |
transform.rotation = rot; | |
if (is_tablet==1)transform.rotation=rot*Quaternion.AngleAxis(90,Vector3.forward); | |
} | |
#endif | |
#if UNITY_EDITOR | |
if (emulateMouseInEditor){ | |
if (axes == RotationAxes.MouseXAndY) | |
{ | |
float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX; | |
rotationY += Input.GetAxis("Mouse Y") * sensitivityY; | |
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY); | |
transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0); | |
} | |
else if (axes == RotationAxes.MouseX) | |
{ | |
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0); | |
} | |
else | |
{ | |
rotationY += Input.GetAxis("Mouse Y") * sensitivityY; | |
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY); | |
transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0); | |
} | |
} | |
#endif | |
} | |
void OnGUI () | |
{ | |
/* if (GUI.Button(new Rect(Screen.width/4-150, Screen.height-100, 300,100), "+IPD")){ | |
Debug.Log("Clicked the button with an image"); | |
IPDCorrection=IPDCorrection+0.01f; | |
setIPDCorrection(IPDCorrection); | |
} | |
if (GUI.Button(new Rect(Screen.width-Screen.width/4-150, Screen.height-100, 300,100), "-IPD")){ | |
Debug.Log("Clicked the button with an image"); | |
IPDCorrection=IPDCorrection-0.01f; | |
setIPDCorrection(IPDCorrection); | |
} | |
*/ | |
if (show_gyro_error_message) | |
{ | |
if(GUI.Button(new Rect(0,0, Screen.width, Screen.height) , "Error: \n\n No Gyro detected \n \n Touch screen to continue anyway")) { | |
show_gyro_error_message=false; | |
} | |
GUI.DrawTexture(new Rect(Screen.width/2-320, Screen.height/2-240, 640, 480), nogyrotexture, ScaleMode.ScaleToFit, true, 0); | |
return; | |
} | |
} | |
void setIPDCorrection(float correction) { | |
// not using camera nearclipplane value because that leads to problems with field of view in different projects | |
cameraleft.projectionMatrix = PerspectiveOffCenter((-zoom+correction)*(znear/0.1f), (zoom+correction)*(znear/0.1f), -zoom*(znear/0.1f)*aspectRatio, zoom*(znear/0.1f)*aspectRatio, znear, zfar);; | |
cameraright.projectionMatrix = PerspectiveOffCenter((-zoom-correction)*(znear/0.1f), (zoom-correction)*(znear/0.1f), -zoom*(znear/0.1f)*aspectRatio, zoom*(znear/0.1f)*aspectRatio, znear, zfar);; | |
} | |
static Matrix4x4 PerspectiveOffCenter(float left, float right, float bottom, float top, float near, float far) { | |
float x = 2.0F * near / (right - left); | |
float y = 2.0F * near / (top - bottom); | |
float a = (right + left) / (right - left); | |
float b = (top + bottom) / (top - bottom); | |
float c = -(far + near) / (far - near); | |
float d = -(2.0F * far * near) / (far - near); | |
float e = -1.0F; | |
Matrix4x4 m = new Matrix4x4(); | |
m[0, 0] = x; | |
m[0, 1] = 0; | |
m[0, 2] = a; | |
m[0, 3] = 0; | |
m[1, 0] = 0; | |
m[1, 1] = y; | |
m[1, 2] = b; | |
m[1, 3] = 0; | |
m[2, 0] = 0; | |
m[2, 1] = 0; | |
m[2, 2] = c; | |
m[2, 3] = d; | |
m[3, 0] = 0; | |
m[3, 1] = 0; | |
m[3, 2] = e; | |
m[3, 3] = 0; | |
return m; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var motor : CharacterMotor; | |
// Use this for initialization | |
function Awake () { | |
motor = GetComponent(CharacterMotor); | |
} | |
// Update is called once per frame | |
function Update () { | |
// Get the input vector from keyboard or analog stick | |
var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); | |
if (directionVector != Vector3.zero) { | |
// Get the length of the directon vector and then normalize it | |
// Dividing by the length is cheaper than normalizing when we already have the length anyway | |
var directionLength = directionVector.magnitude; | |
directionVector = directionVector / directionLength; | |
// Make sure the length is no bigger than 1 | |
directionLength = Mathf.Min(1, directionLength); | |
// Make the input vector more sensitive towards the extremes and less sensitive in the middle | |
// This makes it easier to control slow speeds when using analog sticks | |
directionLength = directionLength * directionLength; | |
// Multiply the normalized direction vector by the modified length | |
directionVector = directionVector * directionLength; | |
} | |
// Apply the direction to the CharacterMotor | |
motor.inputMoveDirection = transform.rotation * directionVector; | |
motor.inputJump = Input.GetButton("Jump"); | |
} | |
// Require a character controller to be attached to the same game object | |
@script RequireComponent (CharacterMotor) | |
@script AddComponentMenu ("Character/FPS Input Controller") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
/// MouseLook rotates the transform based on the mouse delta. | |
/// Minimum and Maximum values can be used to constrain the possible rotation | |
/// To make an FPS style character: | |
/// - Create a capsule. | |
/// - Add the MouseLook script to the capsule. | |
/// -> Set the mouse look to use LookX. (You want to only turn character but not tilt it) | |
/// - Add FPSInputController script to the capsule | |
/// -> A CharacterMotor and a CharacterController component will be automatically added. | |
/// - Create a camera. Make the camera a child of the capsule. Reset it's transform. | |
/// - Add a MouseLook script to the camera. | |
/// -> Set the mouse look to use LookY. (You want the camera to tilt up and down like a head. The character already turns.) | |
[AddComponentMenu("Camera-Control/Mouse Look")] | |
public class MouseLook : MonoBehaviour { | |
public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 } | |
public RotationAxes axes = RotationAxes.MouseXAndY; | |
public float sensitivityX = 15F; | |
public float sensitivityY = 15F; | |
public float minimumX = -360F; | |
public float maximumX = 360F; | |
public float minimumY = -60F; | |
public float maximumY = 60F; | |
float rotationY = 0F; | |
void Update () | |
{ | |
if (axes == RotationAxes.MouseXAndY) | |
{ | |
float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX; | |
rotationY += Input.GetAxis("Mouse Y") * sensitivityY; | |
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY); | |
transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0); | |
} | |
else if (axes == RotationAxes.MouseX) | |
{ | |
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0); | |
} | |
else | |
{ | |
rotationY += Input.GetAxis("Mouse Y") * sensitivityY; | |
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY); | |
transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0); | |
} | |
} | |
void Start () | |
{ | |
// Make the rigid body not change rotation | |
if (GetComponent<Rigidbody>()) | |
GetComponent<Rigidbody>().freezeRotation = true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
#pragma implicit | |
#pragma downcast | |
// Does this script currently respond to input? | |
var canControl : boolean = true; | |
var useFixedUpdate : boolean = true; | |
// For the next variables, @System.NonSerialized tells Unity to not serialize the variable or show it in the inspector view. | |
// Very handy for organization! | |
// The current global direction we want the character to move in. | |
@System.NonSerialized | |
var inputMoveDirection : Vector3 = Vector3.zero; | |
// Is the jump button held down? We use this interface instead of checking | |
// for the jump button directly so this script can also be used by AIs. | |
@System.NonSerialized | |
var inputJump : boolean = false; | |
class CharacterMotorMovement { | |
// The maximum horizontal speed when moving | |
var maxForwardSpeed : float = 10.0; | |
var maxSidewaysSpeed : float = 10.0; | |
var maxBackwardsSpeed : float = 10.0; | |
// Curve for multiplying speed based on slope (negative = downwards) | |
var slopeSpeedMultiplier : AnimationCurve = AnimationCurve(Keyframe(-90, 1), Keyframe(0, 1), Keyframe(90, 0)); | |
// How fast does the character change speeds? Higher is faster. | |
var maxGroundAcceleration : float = 30.0; | |
var maxAirAcceleration : float = 20.0; | |
// The gravity for the character | |
var gravity : float = 10.0; | |
var maxFallSpeed : float = 20.0; | |
// For the next variables, @System.NonSerialized tells Unity to not serialize the variable or show it in the inspector view. | |
// Very handy for organization! | |
// The last collision flags returned from controller.Move | |
@System.NonSerialized | |
var collisionFlags : CollisionFlags; | |
// We will keep track of the character's current velocity, | |
@System.NonSerialized | |
var velocity : Vector3; | |
// This keeps track of our current velocity while we're not grounded | |
@System.NonSerialized | |
var frameVelocity : Vector3 = Vector3.zero; | |
@System.NonSerialized | |
var hitPoint : Vector3 = Vector3.zero; | |
@System.NonSerialized | |
var lastHitPoint : Vector3 = Vector3(Mathf.Infinity, 0, 0); | |
} | |
var movement : CharacterMotorMovement = CharacterMotorMovement(); | |
enum MovementTransferOnJump { | |
None, // The jump is not affected by velocity of floor at all. | |
InitTransfer, // Jump gets its initial velocity from the floor, then gradualy comes to a stop. | |
PermaTransfer, // Jump gets its initial velocity from the floor, and keeps that velocity until landing. | |
PermaLocked // Jump is relative to the movement of the last touched floor and will move together with that floor. | |
} | |
// We will contain all the jumping related variables in one helper class for clarity. | |
class CharacterMotorJumping { | |
// Can the character jump? | |
var enabled : boolean = true; | |
// How high do we jump when pressing jump and letting go immediately | |
var baseHeight : float = 1.0; | |
// We add extraHeight units (meters) on top when holding the button down longer while jumping | |
var extraHeight : float = 4.1; | |
// How much does the character jump out perpendicular to the surface on walkable surfaces? | |
// 0 means a fully vertical jump and 1 means fully perpendicular. | |
var perpAmount : float = 0.0; | |
// How much does the character jump out perpendicular to the surface on too steep surfaces? | |
// 0 means a fully vertical jump and 1 means fully perpendicular. | |
var steepPerpAmount : float = 0.5; | |
// For the next variables, @System.NonSerialized tells Unity to not serialize the variable or show it in the inspector view. | |
// Very handy for organization! | |
// Are we jumping? (Initiated with jump button and not grounded yet) | |
// To see if we are just in the air (initiated by jumping OR falling) see the grounded variable. | |
@System.NonSerialized | |
var jumping : boolean = false; | |
@System.NonSerialized | |
var holdingJumpButton : boolean = false; | |
// the time we jumped at (Used to determine for how long to apply extra jump power after jumping.) | |
@System.NonSerialized | |
var lastStartTime : float = 0.0; | |
@System.NonSerialized | |
var lastButtonDownTime : float = -100; | |
@System.NonSerialized | |
var jumpDir : Vector3 = Vector3.up; | |
} | |
var jumping : CharacterMotorJumping = CharacterMotorJumping(); | |
class CharacterMotorMovingPlatform { | |
var enabled : boolean = true; | |
var movementTransfer : MovementTransferOnJump = MovementTransferOnJump.PermaTransfer; | |
@System.NonSerialized | |
var hitPlatform : Transform; | |
@System.NonSerialized | |
var activePlatform : Transform; | |
@System.NonSerialized | |
var activeLocalPoint : Vector3; | |
@System.NonSerialized | |
var activeGlobalPoint : Vector3; | |
@System.NonSerialized | |
var activeLocalRotation : Quaternion; | |
@System.NonSerialized | |
var activeGlobalRotation : Quaternion; | |
@System.NonSerialized | |
var lastMatrix : Matrix4x4; | |
@System.NonSerialized | |
var platformVelocity : Vector3; | |
@System.NonSerialized | |
var newPlatform : boolean; | |
} | |
var movingPlatform : CharacterMotorMovingPlatform = CharacterMotorMovingPlatform(); | |
class CharacterMotorSliding { | |
// Does the character slide on too steep surfaces? | |
var enabled : boolean = true; | |
// How fast does the character slide on steep surfaces? | |
var slidingSpeed : float = 15; | |
// How much can the player control the sliding direction? | |
// If the value is 0.5 the player can slide sideways with half the speed of the downwards sliding speed. | |
var sidewaysControl : float = 1.0; | |
// How much can the player influence the sliding speed? | |
// If the value is 0.5 the player can speed the sliding up to 150% or slow it down to 50%. | |
var speedControl : float = 0.4; | |
} | |
var sliding : CharacterMotorSliding = CharacterMotorSliding(); | |
@System.NonSerialized | |
var grounded : boolean = true; | |
@System.NonSerialized | |
var groundNormal : Vector3 = Vector3.zero; | |
private var lastGroundNormal : Vector3 = Vector3.zero; | |
private var tr : Transform; | |
private var controller : CharacterController; | |
function Awake () { | |
controller = GetComponent (CharacterController); | |
tr = transform; | |
} | |
private function UpdateFunction () { | |
// We copy the actual velocity into a temporary variable that we can manipulate. | |
var velocity : Vector3 = movement.velocity; | |
// Update velocity based on input | |
velocity = ApplyInputVelocityChange(velocity); | |
// Apply gravity and jumping force | |
velocity = ApplyGravityAndJumping (velocity); | |
// Moving platform support | |
var moveDistance : Vector3 = Vector3.zero; | |
if (MoveWithPlatform()) { | |
var newGlobalPoint : Vector3 = movingPlatform.activePlatform.TransformPoint(movingPlatform.activeLocalPoint); | |
moveDistance = (newGlobalPoint - movingPlatform.activeGlobalPoint); | |
if (moveDistance != Vector3.zero) | |
controller.Move(moveDistance); | |
// Support moving platform rotation as well: | |
var newGlobalRotation : Quaternion = movingPlatform.activePlatform.rotation * movingPlatform.activeLocalRotation; | |
var rotationDiff : Quaternion = newGlobalRotation * Quaternion.Inverse(movingPlatform.activeGlobalRotation); | |
var yRotation = rotationDiff.eulerAngles.y; | |
if (yRotation != 0) { | |
// Prevent rotation of the local up vector | |
tr.Rotate(0, yRotation, 0); | |
} | |
} | |
// Save lastPosition for velocity calculation. | |
var lastPosition : Vector3 = tr.position; | |
// We always want the movement to be framerate independent. Multiplying by Time.deltaTime does this. | |
var currentMovementOffset : Vector3 = velocity * Time.deltaTime; | |
// Find out how much we need to push towards the ground to avoid loosing grouning | |
// when walking down a step or over a sharp change in slope. | |
var pushDownOffset : float = Mathf.Max(controller.stepOffset, Vector3(currentMovementOffset.x, 0, currentMovementOffset.z).magnitude); | |
if (grounded) | |
currentMovementOffset -= pushDownOffset * Vector3.up; | |
// Reset variables that will be set by collision function | |
movingPlatform.hitPlatform = null; | |
groundNormal = Vector3.zero; | |
// Move our character! | |
movement.collisionFlags = controller.Move (currentMovementOffset); | |
movement.lastHitPoint = movement.hitPoint; | |
lastGroundNormal = groundNormal; | |
if (movingPlatform.enabled && movingPlatform.activePlatform != movingPlatform.hitPlatform) { | |
if (movingPlatform.hitPlatform != null) { | |
movingPlatform.activePlatform = movingPlatform.hitPlatform; | |
movingPlatform.lastMatrix = movingPlatform.hitPlatform.localToWorldMatrix; | |
movingPlatform.newPlatform = true; | |
} | |
} | |
// Calculate the velocity based on the current and previous position. | |
// This means our velocity will only be the amount the character actually moved as a result of collisions. | |
var oldHVelocity : Vector3 = new Vector3(velocity.x, 0, velocity.z); | |
movement.velocity = (tr.position - lastPosition) / Time.deltaTime; | |
var newHVelocity : Vector3 = new Vector3(movement.velocity.x, 0, movement.velocity.z); | |
// The CharacterController can be moved in unwanted directions when colliding with things. | |
// We want to prevent this from influencing the recorded velocity. | |
if (oldHVelocity == Vector3.zero) { | |
movement.velocity = new Vector3(0, movement.velocity.y, 0); | |
} | |
else { | |
var projectedNewVelocity : float = Vector3.Dot(newHVelocity, oldHVelocity) / oldHVelocity.sqrMagnitude; | |
movement.velocity = oldHVelocity * Mathf.Clamp01(projectedNewVelocity) + movement.velocity.y * Vector3.up; | |
} | |
if (movement.velocity.y < velocity.y - 0.001) { | |
if (movement.velocity.y < 0) { | |
// Something is forcing the CharacterController down faster than it should. | |
// Ignore this | |
movement.velocity.y = velocity.y; | |
} | |
else { | |
// The upwards movement of the CharacterController has been blocked. | |
// This is treated like a ceiling collision - stop further jumping here. | |
jumping.holdingJumpButton = false; | |
} | |
} | |
// We were grounded but just loosed grounding | |
if (grounded && !IsGroundedTest()) { | |
grounded = false; | |
// Apply inertia from platform | |
if (movingPlatform.enabled && | |
(movingPlatform.movementTransfer == MovementTransferOnJump.InitTransfer || | |
movingPlatform.movementTransfer == MovementTransferOnJump.PermaTransfer) | |
) { | |
movement.frameVelocity = movingPlatform.platformVelocity; | |
movement.velocity += movingPlatform.platformVelocity; | |
} | |
SendMessage("OnFall", SendMessageOptions.DontRequireReceiver); | |
// We pushed the character down to ensure it would stay on the ground if there was any. | |
// But there wasn't so now we cancel the downwards offset to make the fall smoother. | |
tr.position += pushDownOffset * Vector3.up; | |
} | |
// We were not grounded but just landed on something | |
else if (!grounded && IsGroundedTest()) { | |
grounded = true; | |
jumping.jumping = false; | |
SubtractNewPlatformVelocity(); | |
SendMessage("OnLand", SendMessageOptions.DontRequireReceiver); | |
} | |
// Moving platforms support | |
if (MoveWithPlatform()) { | |
// Use the center of the lower half sphere of the capsule as reference point. | |
// This works best when the character is standing on moving tilting platforms. | |
movingPlatform.activeGlobalPoint = tr.position + Vector3.up * (controller.center.y - controller.height*0.5 + controller.radius); | |
movingPlatform.activeLocalPoint = movingPlatform.activePlatform.InverseTransformPoint(movingPlatform.activeGlobalPoint); | |
// Support moving platform rotation as well: | |
movingPlatform.activeGlobalRotation = tr.rotation; | |
movingPlatform.activeLocalRotation = Quaternion.Inverse(movingPlatform.activePlatform.rotation) * movingPlatform.activeGlobalRotation; | |
} | |
} | |
function FixedUpdate () { | |
if (movingPlatform.enabled) { | |
if (movingPlatform.activePlatform != null) { | |
if (!movingPlatform.newPlatform) { | |
var lastVelocity : Vector3 = movingPlatform.platformVelocity; | |
movingPlatform.platformVelocity = ( | |
movingPlatform.activePlatform.localToWorldMatrix.MultiplyPoint3x4(movingPlatform.activeLocalPoint) | |
- movingPlatform.lastMatrix.MultiplyPoint3x4(movingPlatform.activeLocalPoint) | |
) / Time.deltaTime; | |
} | |
movingPlatform.lastMatrix = movingPlatform.activePlatform.localToWorldMatrix; | |
movingPlatform.newPlatform = false; | |
} | |
else { | |
movingPlatform.platformVelocity = Vector3.zero; | |
} | |
} | |
if (useFixedUpdate) | |
UpdateFunction(); | |
} | |
function Update () { | |
if (!useFixedUpdate) | |
UpdateFunction(); | |
} | |
private function ApplyInputVelocityChange (velocity : Vector3) { | |
if (!canControl) | |
inputMoveDirection = Vector3.zero; | |
// Find desired velocity | |
var desiredVelocity : Vector3; | |
if (grounded && TooSteep()) { | |
// The direction we're sliding in | |
desiredVelocity = Vector3(groundNormal.x, 0, groundNormal.z).normalized; | |
// Find the input movement direction projected onto the sliding direction | |
var projectedMoveDir = Vector3.Project(inputMoveDirection, desiredVelocity); | |
// Add the sliding direction, the spped control, and the sideways control vectors | |
desiredVelocity = desiredVelocity + projectedMoveDir * sliding.speedControl + (inputMoveDirection - projectedMoveDir) * sliding.sidewaysControl; | |
// Multiply with the sliding speed | |
desiredVelocity *= sliding.slidingSpeed; | |
} | |
else | |
desiredVelocity = GetDesiredHorizontalVelocity(); | |
if (movingPlatform.enabled && movingPlatform.movementTransfer == MovementTransferOnJump.PermaTransfer) { | |
desiredVelocity += movement.frameVelocity; | |
desiredVelocity.y = 0; | |
} | |
if (grounded) | |
desiredVelocity = AdjustGroundVelocityToNormal(desiredVelocity, groundNormal); | |
else | |
velocity.y = 0; | |
// Enforce max velocity change | |
var maxVelocityChange : float = GetMaxAcceleration(grounded) * Time.deltaTime; | |
var velocityChangeVector : Vector3 = (desiredVelocity - velocity); | |
if (velocityChangeVector.sqrMagnitude > maxVelocityChange * maxVelocityChange) { | |
velocityChangeVector = velocityChangeVector.normalized * maxVelocityChange; | |
} | |
// If we're in the air and don't have control, don't apply any velocity change at all. | |
// If we're on the ground and don't have control we do apply it - it will correspond to friction. | |
if (grounded || canControl) | |
velocity += velocityChangeVector; | |
if (grounded) { | |
// When going uphill, the CharacterController will automatically move up by the needed amount. | |
// Not moving it upwards manually prevent risk of lifting off from the ground. | |
// When going downhill, DO move down manually, as gravity is not enough on steep hills. | |
velocity.y = Mathf.Min(velocity.y, 0); | |
} | |
return velocity; | |
} | |
private function ApplyGravityAndJumping (velocity : Vector3) { | |
if (!inputJump || !canControl) { | |
jumping.holdingJumpButton = false; | |
jumping.lastButtonDownTime = -100; | |
} | |
if (inputJump && jumping.lastButtonDownTime < 0 && canControl) | |
jumping.lastButtonDownTime = Time.time; | |
if (grounded) | |
velocity.y = Mathf.Min(0, velocity.y) - movement.gravity * Time.deltaTime; | |
else { | |
velocity.y = movement.velocity.y - movement.gravity * Time.deltaTime; | |
// When jumping up we don't apply gravity for some time when the user is holding the jump button. | |
// This gives more control over jump height by pressing the button longer. | |
if (jumping.jumping && jumping.holdingJumpButton) { | |
// Calculate the duration that the extra jump force should have effect. | |
// If we're still less than that duration after the jumping time, apply the force. | |
if (Time.time < jumping.lastStartTime + jumping.extraHeight / CalculateJumpVerticalSpeed(jumping.baseHeight)) { | |
// Negate the gravity we just applied, except we push in jumpDir rather than jump upwards. | |
velocity += jumping.jumpDir * movement.gravity * Time.deltaTime; | |
} | |
} | |
// Make sure we don't fall any faster than maxFallSpeed. This gives our character a terminal velocity. | |
velocity.y = Mathf.Max (velocity.y, -movement.maxFallSpeed); | |
} | |
if (grounded) { | |
// Jump only if the jump button was pressed down in the last 0.2 seconds. | |
// We use this check instead of checking if it's pressed down right now | |
// because players will often try to jump in the exact moment when hitting the ground after a jump | |
// and if they hit the button a fraction of a second too soon and no new jump happens as a consequence, | |
// it's confusing and it feels like the game is buggy. | |
if (jumping.enabled && canControl && (Time.time - jumping.lastButtonDownTime < 0.2)) { | |
grounded = false; | |
jumping.jumping = true; | |
jumping.lastStartTime = Time.time; | |
jumping.lastButtonDownTime = -100; | |
jumping.holdingJumpButton = true; | |
// Calculate the jumping direction | |
if (TooSteep()) | |
jumping.jumpDir = Vector3.Slerp(Vector3.up, groundNormal, jumping.steepPerpAmount); | |
else | |
jumping.jumpDir = Vector3.Slerp(Vector3.up, groundNormal, jumping.perpAmount); | |
// Apply the jumping force to the velocity. Cancel any vertical velocity first. | |
velocity.y = 0; | |
velocity += jumping.jumpDir * CalculateJumpVerticalSpeed (jumping.baseHeight); | |
// Apply inertia from platform | |
if (movingPlatform.enabled && | |
(movingPlatform.movementTransfer == MovementTransferOnJump.InitTransfer || | |
movingPlatform.movementTransfer == MovementTransferOnJump.PermaTransfer) | |
) { | |
movement.frameVelocity = movingPlatform.platformVelocity; | |
velocity += movingPlatform.platformVelocity; | |
} | |
SendMessage("OnJump", SendMessageOptions.DontRequireReceiver); | |
} | |
else { | |
jumping.holdingJumpButton = false; | |
} | |
} | |
return velocity; | |
} | |
function OnControllerColliderHit (hit : ControllerColliderHit) { | |
if (hit.normal.y > 0 && hit.normal.y > groundNormal.y && hit.moveDirection.y < 0) { | |
if ((hit.point - movement.lastHitPoint).sqrMagnitude > 0.001 || lastGroundNormal == Vector3.zero) | |
groundNormal = hit.normal; | |
else | |
groundNormal = lastGroundNormal; | |
movingPlatform.hitPlatform = hit.collider.transform; | |
movement.hitPoint = hit.point; | |
movement.frameVelocity = Vector3.zero; | |
} | |
} | |
private function SubtractNewPlatformVelocity () { | |
// When landing, subtract the velocity of the new ground from the character's velocity | |
// since movement in ground is relative to the movement of the ground. | |
if (movingPlatform.enabled && | |
(movingPlatform.movementTransfer == MovementTransferOnJump.InitTransfer || | |
movingPlatform.movementTransfer == MovementTransferOnJump.PermaTransfer) | |
) { | |
// If we landed on a new platform, we have to wait for two FixedUpdates | |
// before we know the velocity of the platform under the character | |
if (movingPlatform.newPlatform) { | |
var platform : Transform = movingPlatform.activePlatform; | |
yield WaitForFixedUpdate(); | |
yield WaitForFixedUpdate(); | |
if (grounded && platform == movingPlatform.activePlatform) | |
yield 1; | |
} | |
movement.velocity -= movingPlatform.platformVelocity; | |
} | |
} | |
private function MoveWithPlatform () : boolean { | |
return ( | |
movingPlatform.enabled | |
&& (grounded || movingPlatform.movementTransfer == MovementTransferOnJump.PermaLocked) | |
&& movingPlatform.activePlatform != null | |
); | |
} | |
private function GetDesiredHorizontalVelocity () { | |
// Find desired velocity | |
var desiredLocalDirection : Vector3 = tr.InverseTransformDirection(inputMoveDirection); | |
var maxSpeed : float = MaxSpeedInDirection(desiredLocalDirection); | |
if (grounded) { | |
// Modify max speed on slopes based on slope speed multiplier curve | |
var movementSlopeAngle = Mathf.Asin(movement.velocity.normalized.y) * Mathf.Rad2Deg; | |
maxSpeed *= movement.slopeSpeedMultiplier.Evaluate(movementSlopeAngle); | |
} | |
return tr.TransformDirection(desiredLocalDirection * maxSpeed); | |
} | |
private function AdjustGroundVelocityToNormal (hVelocity : Vector3, groundNormal : Vector3) : Vector3 { | |
var sideways : Vector3 = Vector3.Cross(Vector3.up, hVelocity); | |
return Vector3.Cross(sideways, groundNormal).normalized * hVelocity.magnitude; | |
} | |
private function IsGroundedTest () { | |
return (groundNormal.y > 0.01); | |
} | |
function GetMaxAcceleration (grounded : boolean) : float { | |
// Maximum acceleration on ground and in air | |
if (grounded) | |
return movement.maxGroundAcceleration; | |
else | |
return movement.maxAirAcceleration; | |
} | |
function CalculateJumpVerticalSpeed (targetJumpHeight : float) { | |
// From the jump height and gravity we deduce the upwards speed | |
// for the character to reach at the apex. | |
return Mathf.Sqrt (2 * targetJumpHeight * movement.gravity); | |
} | |
function IsJumping () { | |
return jumping.jumping; | |
} | |
function IsSliding () { | |
return (grounded && sliding.enabled && TooSteep()); | |
} | |
function IsTouchingCeiling () { | |
return (movement.collisionFlags & CollisionFlags.CollidedAbove) != 0; | |
} | |
function IsGrounded () { | |
return grounded; | |
} | |
function TooSteep () { | |
return (groundNormal.y <= Mathf.Cos(controller.slopeLimit * Mathf.Deg2Rad)); | |
} | |
function GetDirection () { | |
return inputMoveDirection; | |
} | |
function SetControllable (controllable : boolean) { | |
canControl = controllable; | |
} | |
// Project a direction onto elliptical quater segments based on forward, sideways, and backwards speed. | |
// The function returns the length of the resulting vector. | |
function MaxSpeedInDirection (desiredMovementDirection : Vector3) : float { | |
if (desiredMovementDirection == Vector3.zero) | |
return 0; | |
else { | |
var zAxisEllipseMultiplier : float = (desiredMovementDirection.z > 0 ? movement.maxForwardSpeed : movement.maxBackwardsSpeed) / movement.maxSidewaysSpeed; | |
var temp : Vector3 = new Vector3(desiredMovementDirection.x, 0, desiredMovementDirection.z / zAxisEllipseMultiplier).normalized; | |
var length : float = new Vector3(temp.x, 0, temp.z * zAxisEllipseMultiplier).magnitude * movement.maxSidewaysSpeed; | |
return length; | |
} | |
} | |
function SetVelocity (velocity : Vector3) { | |
grounded = false; | |
movement.velocity = velocity; | |
movement.frameVelocity = Vector3.zero; | |
SendMessage("OnExternalVelocity"); | |
} | |
// Require a character controller to be attached to the same game object | |
@script RequireComponent (CharacterController) | |
@script AddComponentMenu ("Character/Character Motor") |
Final Piece Textured Models
Here is a selection of my finished models now they have been textured.
Creating the Skybox
Here is a screenshot of my skybox once I have put all six images together. The six images are attached to both of my cameras, and appear behind everything placed in the scene, creating the illusion of a full 360 degree sky.
Landscape Photography
As a starting point of my exploration into the creation of imaginary environments, I decided to do some photography of real life landscapes as inspiration. I looked for varying landscapes within close geographical range, and tried to find some that are out of the norm, for example, the burnt trees within the long grass, or the waterfall surrounded by skyscrapers.
Gallery is empty
Berlin & Warsaw Photography
Whilst in Berlin and Warsaw, I took photos of the environment to give me inspiration into creating an imaginary environment as these places have a completely different landscape to that I am used to in England. I focused on elements of the built environment, in keeping with my ideas of creating a 2D/3D cityscape, and other elements of the landscape to create an interesting moodboard of environments.
Gallery is empty
Virtual Reality Test Piece 4
This test piece is made up of a single model, borrowed from the internet, to help me realise the capabilities of making a virtual reality environment out of a well known painting.
Virtual Reality Test Piece 3
This test piece followed my idea of making a 3D world made up of supposedly 2D items: newspapers. I 3D modelled the buildings, as seen earlier, and textured them with text and well know newspaper logos.
Virtual Reality Test Piece 2
This is the first fully modelled environment that I created in unity. I uploaded it onto a phone and at the first test stage it would only respond to touch, not movement, so by the second testing stage I perfected the scripts to account for head tracking. I also got a third party person, with no experience with google cardboard or virtual reality in general, to test out my piece, simply giving the instructions that she describe what she was doing as she did it. This allowed me to test how simple the piece was to use, and whether it worked even when you don't know what you are looking for.
Tarot UV Mapping Test
Here is a screenshot of my first try of UV mapped texturing. I unwrapped my empress tarot card model as a smart UV object. This gives me the object in 'net' form in multiple different parts, as close to those matching the axis' as possible (front, side, and top). From this, I can transform the faces and move each individual point until the texture fits perfectly onto the object.
Wolf Modelling Practice Reference Images
These are the reference images I used to model my first cube mesh object.
Subdivision Surface Modifier Tests
Testing My Pieces on Oculus
Here are images of me testing my own virtual reality test scenes on the oculus rift. I used a unity plugin to convert my project into an oculus rift ready one, and ran it on the headset to compare its performance to the google cardboard.
Setting Up Oculus Rift and Leap motion
Here are photos and instructions documenting the set up of the oculus rift with leap motion
Plug in the wires to the headset as shown |
Slot the cover over the wires |
Plug the other end of these connecting wires into your USB port (or straight into the computer if you have more than 4 USB slots) |
Attach the other end into the HDMI adapter |
Plug the HDMI adapter into the micro USB port |
This is how your computer screen will now appear |
Plug the wire into the Infared camera as shown |
Plug the other end into the wirebox as shown |
Plug the USB wire into the other slot on the camera |
And plug the other end of that into the USB port |
Attach the camera to the top of your monitor |
Plug in the power supply |
And plug in the other end into the wirebox |
A blue light should come on the headset indicating it is on |
Change the resolution settings on your computer to make the screen appear normal |
Plug the grey wire into the side of the leap motion |
Slot the leap motion into the cradle on the front of the oculus headset |
Plug the USB end into the USB extender |
Plug the other end into the USB port and enjoy! |
Building Google Cardboard
Here I have created a simple stop motion animation of the creation of a google cardboard headset, to accompany my instructions.
The standard Google Cardboard kit containing everything you need: Laser cut cardboard part, Velcro, Glass lenses, Two magnets, Elastic Band. |
The first pre-cut piece |
Start by popping out all the removable sections |
Score along all of the creases |
Fold the cardboard as shown |
Slot the edges into the holes to keep it in place |
Stick hooked and looped sides of the velcro1 together, and stick to the top of the google cardboard |
Close the cardboard, leaving enough room for where a phone would be, and stick the other side of the velcro to this part to ensure the velcro will line up. |
Hold a magnet in place in the slot on the side... |
And put the other magnet on the other side so both with stay up on their own |
Using double sided tape (optional) stick or place lenses in third compartment circles of first cardboard piece. |
Fold the third section over the second... |
And fold the first section underneath the other two |
Slot the eyepiece into the body of the headset |
Open out again with the velcro now securely in place |
Slot in the dividing piece between the eye holes, with the gap allowing room for your nose |
Slot a phone into the headset, already running a google cardboard capable app |
Close and enjoy! |
Flash Animation Plan
This is a sketch of the painting I am going to create a virtual world of, with a few of the elements animated in flash. This helps give me an idea of which parts I could animate to make the piece less static, and also will help me decide how to go about it when it comes to 3D animating it.
Final Assets Reference Drawings
These are the Images I created from my orthographic blueprints. For each of the more complicated elements of the painting that i am going to model I have drawn out a perspective-free version of the front, top, and side of the object (and more for some of the even more complex shapes).
Bottle - Perspective View
Bottle - Front View
Bottle - Left View
Bottle - Top View
Branch - Front View
Branch - Left View
Branch - Top View
Clock One - Perspective View
Clock One - Front View
Clock One - Left View
Clock One - Top View
Clock Two - Perspective View
Clock Two - Front View
Clock Two - Back View
Clock Two - Left View
Clock Two - Top
Clock Three - Perspective View
Clock Three - Back View
Clock Three - Front View
Clock Three - Left
Clock Three - Top View
'Dali's face' - Perspective View
Dali's Face - Left View

Dali's Face - Right View
Dali's Face - Top View
Orthographic Drawings
These are the 'blueprints' I drew out for creating my 3D models for my final piece. I traced out the original objects to ensure they were accurate, and then used this to create dotted guidelines to keep everything in proportion. After I drew out each side I would copy and paste it at a right angle to make sure it would all fit together perfectly in 3D.
Trump Modelling Reference Images
These are the different viewpoint images I used to help me model the Trump building for my skyscrapers test piece. This was my first experience modelling from real life or from reference images, allowing me to create accurate 3D models easily.
Skybox Textures



Leap Motion Input Test
This is a short video of me testing out the user input capability of the leap motion, helping me consider user input methods for my final piece.
Exploring Leap Motion Playground Tests
Here are three different test 'playground' games that are available on leap motion, allowing me to test out its user input capability.
Oculus Rift Test Scene
This is a short video showing me testing out the oculus rift.
Wii Remote - External User Input Test
Here I am testing out using a wii remote to control an object in unity. I connected the wii remote to my computer via bluetooth and ran a script that allowed to control the movement of a cube 'wii parent' with the wii remote.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
using System.Collections; | |
using System.Runtime.InteropServices; | |
public class WiiMote : MonoBehaviour { | |
[DllImport ("UniWii")] | |
private static extern void wiimote_start(); | |
[DllImport ("UniWii")] | |
private static extern void wiimote_stop(); | |
[DllImport ("UniWii")] | |
private static extern int wiimote_count(); | |
[DllImport ("UniWii")] | |
private static extern byte wiimote_getAccX(int which); | |
[DllImport ("UniWii")] | |
private static extern byte wiimote_getAccY(int which); | |
[DllImport ("UniWii")] | |
private static extern byte wiimote_getAccZ(int which); | |
[DllImport ("UniWii")] | |
private static extern float wiimote_getIrX(int which); | |
[DllImport ("UniWii")] | |
private static extern float wiimote_getIrY(int which); | |
[DllImport ("UniWii")] | |
private static extern float wiimote_getRoll(int which); | |
[DllImport ("UniWii")] | |
private static extern float wiimote_getPitch(int which); | |
[DllImport ("UniWii")] | |
private static extern float wiimote_getYaw(int which); | |
private string display; | |
private int cursor_x, cursor_y; | |
private Texture2D cursor_tex; | |
private Vector3 oldVec; | |
// Use this for initialization | |
void Start () { | |
wiimote_start(); | |
cursor_tex = (Texture2D) Resources.Load("crosshair"); | |
} | |
// Update is called once per frame | |
void FixedUpdate () { | |
int c = wiimote_count(); | |
if (c>0) { | |
display = ""; | |
for (int i=0; i<=c-1; i++) { | |
int x = wiimote_getAccX(i); | |
int y = wiimote_getAccY(i); | |
int z = wiimote_getAccZ(i); | |
float roll = Mathf.Round(wiimote_getRoll(i)); | |
float p = Mathf.Round(wiimote_getPitch(i)); | |
float yaw = Mathf.Round(wiimote_getYaw(i)); | |
float ir_x = wiimote_getIrX(i); | |
float ir_y = wiimote_getIrY(i); | |
display += "Wiimote " + i + " accX: " + x + " accY: " + y + " accZ: " + z + " roll: " + roll + " pitch: " + p + " yaw: " + yaw + " IR X: " + ir_x + " IR Y: " + ir_y + "\n"; | |
if (!float.IsNaN(roll) && !float.IsNaN(p) && (i==c-1)) { | |
Vector3 vec = new Vector3(p, 0 , -1 * roll); | |
vec = Vector3.Lerp(oldVec, vec, Time.deltaTime * 5); | |
oldVec = vec; | |
GameObject.Find("wiiparent").transform.eulerAngles = vec; | |
} | |
if ( (i==c-1) && (ir_x != -100) && (ir_y != -100) ) { | |
//float temp_x = ((ir_x + (float) 1.0)/ (float)2.0) * (float) Screen.width; | |
//float temp_y = (float) Screen.height - (((ir_y + (float) 1.0)/ (float)2.0) * (float) Screen.height); | |
float temp_x = ( Screen.width / 2) + ir_x * (float) Screen.width / (float)2.0; | |
float temp_y = Screen.height - (ir_y * (float) Screen.height / (float)2.0); | |
cursor_x = Mathf.RoundToInt(temp_x); | |
cursor_y = Mathf.RoundToInt(temp_y); | |
} | |
} | |
} | |
else display = "Press the '1' and '2' buttons on your Wii Remote."; | |
} | |
void OnApplicationQuit() { | |
wiimote_stop(); | |
} | |
void OnGUI() { | |
GUI.Label( new Rect(10,10, 500, 100), display); | |
if ((cursor_x != 0) || (cursor_y != 0)) GUI.Box ( new Rect (cursor_x, cursor_y, 50, 50), cursor_tex); //"Pointing\nHere"); | |
int c = wiimote_count(); | |
for (int i=0; i<=c-1; i++) { | |
float ir_x = wiimote_getIrX(i); | |
float ir_y = wiimote_getIrY(i); | |
if ( (ir_x != -100) && (ir_y != -100) ) { | |
float temp_x = ((ir_x + (float) 1.0)/ (float)2.0) * (float) Screen.width; | |
float temp_y = (float) Screen.height - (((ir_y + (float) 1.0)/ (float)2.0) * (float) Screen.height); | |
temp_x = Mathf.RoundToInt(temp_x); | |
temp_y = Mathf.RoundToInt(temp_y); | |
//if ((cursor_x != 0) || (cursor_y != 0)) | |
GUI.Box ( new Rect (temp_x, temp_y, 64, 64), "Pointer " + i); | |
} | |
} | |
} | |
} |
Autowalk - Internal User Input Test
This video shows me testing out the autowalk script of the google cardboard .sdk. When the centre of the users vision lands on the sphere I made in the sky for over 2 seconds, it triggers the character controller to start moving forwards, ands stops again if you repeat the action.
Oculus With Leap Motion Testing
These videos (When played at exactly the same time) show both my movements and reactions, and exactly what was being shown inside the headset. Here I am testing out using the oculus rift in conjunction with the leap motion controller so that I am able to interact with the environments I am experiencing.
These are the 3D models that will go on to make up my final piece. I modelled them based on the original painting - The Persistence of Memory - and my orthographic drawings. From this I will go on to texture them to look like those in the paintings, and then build my scene out of them.
Interactive Painting Test Asset - Untextured
This is a model I downloaded off the internet (created by Troy Whitmer) that I used to test out another of my initial ideas - exploring a virtual reality 3D painting.
Tarot Card Test Asset - Untextured
This was a model created to test out another of my initial ideas by drawing around the shape of one of my tarot card characters, and extruding it to make a 3D model.
Skyscraper/Building Test Assets - Untextured
These are the raw, untextured 3D models used in creating my second virtual reality test piece. For these I tried out numerous techniques, such as using boolean modifiers to remove window shaped sections, mesh modelling by combining multiple 3D shapes, extruding flat shapes made up of curves, and transforming shapes using bevel levels.
'Flat' Test Assets - Untextured
These are the untextured 3D models for one of my first test virtual reality pieces. They are all made by extruding flat shapes drawn out using bezier curves.
Modelling 'Flat' Assests: Excrusion Modelling Test Piece
These are fast-motion videos showing my process of creating flat assets for one of my virtual reality test pieces.
Concept 3 - Concept Art
This is another piece of concept art for a possible imaginary environment I could make. It shows a natural scene that is made entirely out of flat objects, as if they are pieces of set. Again, I could use this as a location for a film or animation, or as a virtual reality environment.
Concept 2 - Concept Art
This is concept art for a possible imaginary environment, made up of buildings folded out of newspaper. I could turn this into the location of a short film or animation, or use it as a virtual reality environment.
Concept 1 - Step Outline
This is a step outline for a pice I am considering making, outlining the sound and visuals of what would be happening on screen. It is for a time based piece of a first person point of view animation exploring the relationship between 2D and 3D, in a strangely game-like formatThis allows me to start thinking of concepts in a way that affects multiple senses at once.
This is a step outline for a pice I am considering making, outlining the sound and visuals of what would be happening on screen. It is for a time based piece of a first person point of view animation exploring the relationship between 2D and 3D, in a strangely game-like formatThis allows me to start thinking of concepts in a way that affects multiple senses at once.
Origami Stop Motion - 3rd Test Piece
This is a stop motion animation I made using two identical origami cranes, holding them up to make it look like they are flying across the screen independently, with the background continuously changing and the bird staying the only constant. This started me off thinking about the relationship between the dimensions by using 2D materials (such as paper) to create a 3D animation.
Simple landscape to be viewed through Google Cardboard - 2nd test piece (1st VR Test Piece)
This is a simple virtual reality environment created in unity with a skybox, ground plane, and a few walls representing a shelter of sorts. It can be uploaded onto a phone, and viewed through a google cardboard headset creating a 3D view. When you turn your head, the screen changes as if you are looking around inside the landscape, and you can use the arrow keys on a computer to control movement within the scene. From this, I would like to explore using this medium of virtual reality and google cardboard further.
This is a simple virtual reality environment created in unity with a skybox, ground plane, and a few walls representing a shelter of sorts. It can be uploaded onto a phone, and viewed through a google cardboard headset creating a 3D view. When you turn your head, the screen changes as if you are looking around inside the landscape, and you can use the arrow keys on a computer to control movement within the scene. From this, I would like to explore using this medium of virtual reality and google cardboard further.
These are small, paper houses I made that light up when the environment around them goes dark. I did this by cold soldering - using electricity conductive paint - small circuits into the roof of each house including LED's and Light dependent resistors. The resistors were hidden inside the chimneys of the house and varied the voltage going to the LED's depending on the amount of light hitting them, making the light brighter in dim light and less bright or completely off in brighter light. Because of this, I am considering working with more small circuits and creating electric elements, as well as exploring interactivity/responsiveness further.
No comments:
Post a Comment