Skip to content

Instantly share code, notes, and snippets.

View tsmrecki's full-sized avatar

Tomislav Smrečki tsmrecki

  • Zagreb
View GitHub Profile
@tsmrecki
tsmrecki / Flying.cs
Created May 19, 2016 08:54
Make a object walk forward
void Update(){
GetComponent<Rigidbody> ().velocity = transform.forward * 2.0f;
}
@tsmrecki
tsmrecki / Teleport.cs
Created May 19, 2016 08:52
Getting the component of the object
public void SetGazedAt(bool gazedAt) {
GetComponent<Renderer>().material.color = gazedAt ? Color.green : Color.red;
}
@tsmrecki
tsmrecki / Teleport.cs
Created May 19, 2016 08:50
Class extending MonoBehaviour
public class Teleport : MonoBehaviour {
private Vector3 startingPosition;
void Start() {
startingPosition = transform.localPosition;
SetGazedAt(false);
}
}