Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
877 B

namespace VRTK.Examples
{
using UnityEngine;
public class Whirlygig : VRTK_InteractableObject
{
float spinSpeed = 0f;
Transform rotator;
public override void StartUsing(VRTK_InteractUse currentUsingObject = null)
{
base.StartUsing(currentUsingObject);
spinSpeed = 360f;
}
public override void StopUsing(VRTK_InteractUse previousUsingObject = null, bool resetUsingObjectState = true)
{
base.StopUsing(previousUsingObject, resetUsingObjectState);
spinSpeed = 0f;
}
protected void Start()
{
rotator = transform.Find("Capsule");
}
protected override void Update()
{
base.Update();
rotator.transform.Rotate(new Vector3(spinSpeed * Time.deltaTime, 0f, 0f));
}
}
}