Blog Post 10 | 6/17/2019 & 6/18/2019
We began the Unity class today. The VR Stress team has been working with Unity for the past week for our project, so we knew many of the basic concepts that were looked over today. We took this time to hone our skills. When its comes to Unity, I feel that I still have a lot to learn when it comes to scripting in C#. I was having trouble with the syntax of the language, specifically with the way you have to call objects in the script. In the end, I was able to create a script that moves an object up and down while rotating it. I also was able to import my scene from Maya, and character models from online.
Here is the result of my work today:
On Tuesday, my team and I got even more accomplished with our Unity project. We worked on animating an audience of people sitting in front of the user. We had a meeting with our mentor, Neil, and we determined that we could have a rough draft of our project finished by tomorrow. I’m a little nervous because I feel that we might need more time to have a rough draft finished by tomorrow, but am optimistic that we’ll be successful in our work. There was also a Luncheon Lecture today, which I found quite interesting. The speaker, Jing Dong, discussed the use of self-driving cars in a ride-sharing application. I found this talk really interesting because I’ve also thought about how technologies such as self-driving cars can be implemented into everyday life.
Earlier tonight, my group and I met up to work on our project. I’m having trouble with one of the scripts that is supposed to play music when the spacebar is pressed. I’m think I have the correct syntax and am calling the function correctly:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(AudioSource))]
public class PauseAudio : MonoBehaviour
{
// Start is called before the first frame update
public AudioClip clap;
private AudioSource audioSource;
public bool paused;
void Start()
{
audioSource = GetComponent<AudioSource>();
paused = true;
}
void OnPressed()
{
if (Input.GetKeyDown("space")){
if (paused)
{
audioSource.clip = clap;
audioSource.Play();
paused = false;
}
else if (paused == false) {
audioSource.clip = clap;
audioSource.Pause();
paused = true;
}
}
}
void Update()
{
}
}
I’ll continue looking over the code to find out what I did wrong.
Comments
Blog Post 10 | 6/17/2019 & 6/18/2019 — No Comments
HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>