Last active
October 26, 2018 04:14
-
-
Save heaversm/e36fda828c24a389be0911f61e34a913 to your computer and use it in GitHub Desktop.
A script for rotating a game object around its Y axis in Unity using OSCSimpl
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class CubeScript : MonoBehaviour { | |
public OscIn oscIn; | |
public GameObject go; | |
private float receivedVal; | |
// Use this for initialization | |
void Start () { | |
if ( !oscIn ){ | |
Debug.Log("started"); | |
oscIn = gameObject.AddComponent<OscIn>(); | |
oscIn.Open(7000); | |
oscIn.MapFloat("/1/fader1", OnFader1); | |
} | |
} | |
void OnFader1 (float value){ | |
Debug.Log("Received" + value); | |
receivedVal = value; | |
} | |
// Update is called once per frame | |
void Update () { | |
go.transform.Rotate(0, receivedVal, 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment