Ковешников Арсений Александрович

Size: px
Start display at page:

Download "Ковешников Арсений Александрович"

Transcription

1 Работа призера заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Виртуальная и дополненная реальность» Ковешников Арсений Александрович Класс: 11А Школа: ГБОУ г. Москвы «Курчатовская школа» Уникальный номер участника: 11-6 Город: г. Москва Регион: г. Москва Команда на заключительном этапе: Double K Параллель: Результаты заключительного этапа: Индивидульная часть Командная часть Математика Информатика Макс. Результат Итого Балл Всего ,48

2 Индивидуальная часть Персональный лист участника с номером 11-6:

3 Матемтика

4 Информатика ЗадачаА program VR; var t : integer; input, output : text; ds : array[ ] of integer; a, b, x1, d1, counter : longint; ison : boolean; begin Reset(input, 'input.txt'); Rewrite(output, 'output.txt'); readln(input, a, b, t); ison := true; for counter := 0 to (t div 2) do begin d1 := d1 + 1; ds[counter + 1] := d1; x1 := x1 + d1; end; for counter := (t div 2) + 1 to t - 1 do begin d1 := d1-1; ds[counter + 1] := d1; x1 := x1 + d1; end; if (b - a <> x1) then writeln (-1) else for counter := 1 to t do write(output, ds[counter], ' ') end.

5 Командная часть Результаты были получены в рамках выступления команды: Double K Личный состав команды: Крылов Никита Андреевич Ковешников Арсений Александрович

6 Spawn Charge using System.Collections; using System.Collections.Generic; using UnityEngine; using Valve.VR; using Valve.VR.InteractionSystem; [RequireComponent(typeof(Hand))] public class SpawnCharge : MonoBehaviour Hand hand; public GameObject charge; int indicatorvalue = 1; Charge current; // Use this for initialization void Start () hand = GetComponentInParent<Hand>(); // Update is called once per frame void Update () if (hand.controller!= null) float input = hand.controller.getaxis().x * 4; int v = Mathf.CeilToInt(Mathf.Abs(input)); v *= Mathf.RoundToInt(Mathf.Sign(input)); if (v!= 0) if (v < -4) v = -4; if (v > 4) v = 4; if (v!= 0) indicatorvalue = v; Indicator(indicatorValue); if(current!= null) if(hand.getstandardinteractionbuttondown()) hand.detachobject(current.gameobject); current.onpickup.removelistener(onpickup); current.rb.iskinematic = false; current.rb.interpolation = RigidbodyInterpolation.Interpolate; current.init(); //current.initlines(); current.active = true; Simulation.Instance.AddCharge(current); current = null; else current.value = indicatorvalue;

7 else if(hand.getstandardinteractionbuttondown()) var position = hand.transform.find("attach_controllertip").position; var go = Instantiate(charge, position, Quaternion.identity); hand.attachobject(go, Hand.AttachmentFlags.ParentToHand Hand.AttachmentFlags.DetachFromOtherHand, "Attach_ControllerTip"); current = go.getcomponent<charge>(); current.value = indicatorvalue; current.onpickup.addlistener(onpickup); void Indicator(int value) if (value < 0) ); ; ; ); ue); alse); alse); alse); alse); GameObject.Find("indicator(Clone)").transform.Find("pos").gameObject.SetActive(false GameObject.Find("indicator(Clone)").transform.Find("neg").gameObject.SetActive(true) else GameObject.Find("indicator(Clone)").transform.Find("pos").gameObject.SetActive(true) GameObject.Find("indicator(Clone)").transform.Find("neg").gameObject.SetActive(false switch(mathf.abs(value)) case 1: GameObject.Find("indicator(Clone)").transform.Find("numb1").gameObject.SetActive(tr GameObject.Find("indicator(Clone)").transform.Find("numb2").gameObject.SetActive(f GameObject.Find("indicator(Clone)").transform.Find("numb3").gameObject.SetActive(f GameObject.Find("indicator(Clone)").transform.Find("numb4").gameObject.SetActive(f break; case 2: GameObject.Find("indicator(Clone)").transform.Find("numb1").gameObject.SetActive(f

8 ue); alse); alse); alse); alse); ue); alse); alse); alse); alse); ue); GameObject.Find("indicator(Clone)").transform.Find("numb2").gameObject.SetActive(tr GameObject.Find("indicator(Clone)").transform.Find("numb3").gameObject.SetActive(f GameObject.Find("indicator(Clone)").transform.Find("numb4").gameObject.SetActive(f break; case 3: GameObject.Find("indicator(Clone)").transform.Find("numb1").gameObject.SetActive(f GameObject.Find("indicator(Clone)").transform.Find("numb2").gameObject.SetActive(f GameObject.Find("indicator(Clone)").transform.Find("numb3").gameObject.SetActive(tr GameObject.Find("indicator(Clone)").transform.Find("numb4").gameObject.SetActive(f break; case 4: GameObject.Find("indicator(Clone)").transform.Find("numb1").gameObject.SetActive(f GameObject.Find("indicator(Clone)").transform.Find("numb2").gameObject.SetActive(f GameObject.Find("indicator(Clone)").transform.Find("numb3").gameObject.SetActive(f GameObject.Find("indicator(Clone)").transform.Find("numb4").gameObject.SetActive(tr break; void OnPickUp() current.onpickup.removelistener(onpickup); current.rb.iskinematic = false; current.rb.interpolation = RigidbodyInterpolation.Interpolate; current.init(); //current.initlines(); current.active = true; Simulation.Instance.AddCharge(current); current = null; Singleton

9 using UnityEngine; /// <summary> /// Be aware this will not prevent a non singleton constructor /// such as `T myt = new T();` /// To prevent that, add `protected T () ` to your singleton class. /// /// As a note, this is made as MonoBehaviour because we need Coroutines. /// </summary> public class Singleton<T> : MonoBehaviour where T : MonoBehaviour private static T _instance; private static object _lock = new object(); public static T Instance get if (applicationisquitting) Debug.LogWarning("[Singleton] Instance '"+ typeof(t) + "' already destroyed on application quit." + " Won't create again - returning null."); return null; lock(_lock) if (_instance == null) _instance = (T) FindObjectOfType(typeof(T)); wrong " + if ( FindObjectsOfType(typeof(T)).Length > 1 ) Debug.LogError("[Singleton] Something went really " - there should never be more than 1 singleton!" + " Reopening the scene might fix it."); return _instance; if (_instance == null) GameObject singleton = new GameObject(); _instance = singleton.addcomponent<t>(); singleton.name = "(singleton) "+ typeof(t).tostring(); DontDestroyOnLoad(singleton); Debug.Log("[Singleton] An instance of " + typeof(t) + " is needed in the scene, so '" + singleton + "' was created with DontDestroyOnLoad.");

10 + else Debug.Log("[Singleton] Using instance already created: " _instance.gameobject.name); return _instance; private static bool applicationisquitting = false; /// <summary> /// When Unity quits, it destroys objects in a random order. /// In principle, a Singleton is only destroyed when application quits. /// If any script calls Instance after it have been destroyed, /// it will create a buggy ghost object that will stay on the Editor scene /// even after stopping playing the Application. Really bad! /// So, this was made to be sure we're not creating that buggy ghost object. /// </summary> protected virtual void OnDestroy () applicationisquitting = true; SimulationControl using System.Collections; using System.Collections.Generic; using UnityEngine; using Valve.VR; using Valve.VR.InteractionSystem; [RequireComponent(typeof(Hand))] public class SimulationControl : MonoBehaviour Hand hand; public AudioSource audiosource; public AudioClip[] clips; // Use this for initialization void Start () hand = GetComponent<Hand>(); // Update is called once per frame void Update () if (hand.controller!= null) if(hand.controller.getpressdown(evrbuttonid.k_ebutton_steamvr_touchpad)) var input = hand.controller.getaxis().x; if(input < 0)

11 if (!Simulation.Instance.Paused) e); ; e); GameObject.Find("lefthand(Clone)").transform.Find("pause").gameObject.SetActive(fals GameObject.Find("lefthand(Clone)").transform.Find("play").gameObject.SetActive(true) audiosource.playoneshot(clips[0]); else GameObject.Find("lefthand(Clone)").transform.Find("pause").gameObject.SetActive(tru ); GameObject.Find("lefthand(Clone)").transform.Find("play").gameObject.SetActive(false "Charge(Clone)") Simulation using System; using System.Collections; using System.Collections.Generic; using UnityEngine; audiosource.playoneshot(clips[1]); Simulation.Instance.Paused =!Simulation.Instance.Paused; else if (input > 0) for (int i = 0; i < hand.attachedobjects.count; i++) if(hand.attachedobjects[i].attachedobject.name == public class Simulation : Singleton<Simulation> public float k = 0.1f; public float maxdistance = 1f; List<Charge> charges = new List<Charge>(); bool _paused = false; Vector3[] positions; GPUField.ChargeStruct[] chargesarr; audiosource.playoneshot(clips[2]); var go = hand.attachedobjects[i].attachedobject; hand.detachobject(go); Debug.Log(go.name); var charge = go.getcomponent<charge>(); Debug.Log(charge); Simulation.Instance.RemoveCharge(charge);

12 public int passcount = 10; public int pass = 0; public bool Paused get return _paused; set if (value) for (int i = 0; i < charges.count; i++) charges[i].savevelocity(); charges[i].rb.iskinematic = true; charges[i].rb.interpolation = RigidbodyInterpolation.None; else for (int i = 0; i < charges.count; i++) charges[i].rb.iskinematic = false; charges[i].rb.interpolation = RigidbodyInterpolation.Interpolate; charges[i].restorevelocity(); _paused = value; // Use this for initialization void Start () //chargesarr = new GPUField.ChargeStruct[passCount]; //positions = new Vector3[passCount * 6 * 10]; bool a = true; // Update is called once per frame void Update () #if UNITY_EDITOR for (int i = 0; i < charges.count; i++) charges[i].updatelines(); #else Gist.Parallel.For(0, charges.count, (int i) => charges[i].updatelines(); ); #endif void FixedUpdate() if(!paused) UpdatePhysics(Time.fixedDeltaTime); //if (charges.count > 0) // UpdateLinesGPU();

13 void UpdatePhysics(float T) for (int i = 0; i < charges.count; i++) if(charges[i].active) charges[i].acceleration = Vector3.zero; for (int i = 0; i < charges.count - 1; i++) for (int j = i + 1; j < charges.count; j++) float r = (charges[j].position - charges[i].position).magnitude; if (r <= maxdistance) float F = (k * (charges[i].value) * (charges[j].value)) / (r * r); var v = (charges[j].position - charges[i].position).normalized; if(charges[i].active) charges[i].acceleration -= F * v; if(charges[j].active) charges[j].acceleration += F * v; for (int i = 0; i < charges.count; i++) if(charges[i].active) //charges[i].velocity += charges[i].acceleration * T; //charges[i].position += charges[i].velocity * T; charges[i].rb.velocity += charges[i].acceleration * T; void UpdateLinesGPU() int count = Mathf.Min(charges.Count, passcount); int passes = charges.count / count + (charges.count % count > 0? 1 : 0); for (int i = 0; i < passes; i++) for (int j = 0; j < count; j++) chargesarr[j].position = this.charges[i * count + j].transform.position; chargesarr[j].value = this.charges[i * count + j].value; GPUField.Instance.GetPositions(ref positions, ref chargesarr); var lpositions = new Vector3[10]; for (int j = 0; j < count; j++) for (int k = 0; k < 6; k++) Array.Copy(positions, j * 6 * 10 + k * 10, lpositions, 0, 10); charges[i * count + j].updatelinesgpu(k, ref lpositions);

14 public Vector3 GetField(Vector3 position) Vector3 p = Vector3.zero; for (int i = 0; i < charges.count; i++) float r = (charges[i].position - position).magnitude; if (r <= maxdistance / 2) var v = (charges[i].position - position).normalized; float P = (k * charges[i].value) / (r * r); p += P * v; return p; public Charge GetClosestCharge(Charge charge, Vector3 position) if (charges.count < 2) return null; int self = charges.indexof(charge); int result = -1; float r_sq = float.positiveinfinity; for (int i = 0; i < charges.count; i++) if(i!= self) float sm = (charges[i].position - position).sqrmagnitude; if(sm < r_sq) result = i; r_sq = sm; return charges[result]; public Vector3 GetField(Charge charge, Vector3 position) if (charge == null) return Vector3.zero; float r = (charge.position - position).magnitude; if (r <= maxdistance / 2) var v = (charge.position - position).normalized; float P = (k * charge.value) / (r * r); return P * v; return Vector3.zero; public void AddCharge(Charge charge) charges.add(charge); Debug.Log(charges.Count); public void RemoveCharge(Charge charge)

15 charges.remove(charge); Destroy(charge.gameObject); //IEnumerator UpdateLines() // while() // // PickableBackup using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using Valve.VR.InteractionSystem; [RequireComponent( typeof( Charge ) )] [RequireComponent( typeof( Interactable ) )] public class PickableBackup : MonoBehaviour [EnumFlags] [Tooltip( "The flags used to attach this object to the hand." )] public Hand.AttachmentFlags attachmentflags = Hand.AttachmentFlags.ParentToHand Hand.AttachmentFlags.DetachFromOtherHand; [Tooltip( "Name of the attachment transform under in the hand's hierarchy which the object should should snap to." )] public string attachmentpoint; [Tooltip( "How fast must this object be moving to attach due to a trigger hold instead of a trigger press?" )] public float catchspeedthreshold = 0.0f; [Tooltip( "When detaching the object, should it return to its original parent?" )] public bool restoreoriginalparent = false; private bool attached = false; private float attachtime; private Vector3 attachposition; private Quaternion attachrotation; public UnityEvent onpickup; public UnityEvent ondetachfromhand; public Charge charge; public GameObject highlight; // private void OnHandHoverBegin( Hand hand )

16 if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; Debug.Log(hand.GuessCurrentHandType()); bool showhint = true; // "Catch" the throwable by holding down the interaction button instead of pressing it. // Only do this if the throwable is moving faster than the prescribed threshold speed, // and if it isn't attached to another hand if (!attached ) if ( hand.getstandardinteractionbutton() ) var charge = GetComponent<Charge>(); //if ( charge.velocity.magnitude >= catchspeedthreshold ) hand.attachobject( gameobject, attachmentflags, attachmentpoint ); showhint = false; if ( showhint ) highlight.setactive(true); ControllerButtonHints.ShowButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); // private void OnHandHoverEnd( Hand hand ) if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; highlight.setactive(false); ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); // private void HandHoverUpdate( Hand hand ) if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; //Trigger got pressed

17 if ( hand.getstandardinteractionbuttondown() ) hand.attachobject( gameobject, attachmentflags, attachmentpoint ); ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); // private void OnAttachedToHand( Hand hand ) charge.active = false; if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; attached = true; onpickup.invoke(); hand.hoverlock( null ); //Rigidbody rb = GetComponent<Rigidbody>(); //rb.iskinematic = true; //rb.interpolation = RigidbodyInterpolation.None; if ( hand.controller == null ) //velocityestimator.beginestimatingvelocity(); attachtime = Time.time; attachposition = transform.position; attachrotation = transform.rotation; /*if ( attacheasein ) attacheaseintransform = hand.transform; if (!Util.IsNullOrEmpty( attacheaseinattachmentnames ) ) float smallestangle = float.maxvalue; for ( int i = 0; i < attacheaseinattachmentnames.length; i++ ) Transform t = hand.getattachmenttransform( attacheaseinattachmentnames[i] ); float angle = Quaternion.Angle( t.rotation, attachrotation ); if ( angle < smallestangle ) attacheaseintransform = t; smallestangle = angle;

18 */ //snapattacheaseincompleted = false; // private void OnDetachedFromHand( Hand hand ) charge.active = true; if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; attached = false; ondetachfromhand.invoke(); hand.hoverunlock( null ); //Rigidbody rb = GetComponent<Rigidbody>(); //rb.iskinematic = false; //rb.interpolation = RigidbodyInterpolation.Interpolate; Vector3 position = Vector3.zero; Vector3 velocity = Vector3.zero; Vector3 angularvelocity = Vector3.zero; /*if ( hand.controller == null ) /*velocityestimator.finishestimatingvelocity(); velocity = velocityestimator.getvelocityestimate(); angularvelocity = velocityestimator.getangularvelocityestimate(); position = velocityestimator.transform.position; else velocity = Player.instance.trackingOriginTransform.TransformVector( hand.controller.velocity ); angularvelocity = Player.instance.trackingOriginTransform.TransformVector( hand.controller.angularvelocity ); position = hand.transform.position; */ //Vector3 r = transform.transformpoint( rb.centerofmass ) - position; //rb.velocity = velocity + Vector3.Cross( angularvelocity, r ); //rb.angularvelocity = angularvelocity; // Make the object travel at the release velocity for the amount // of time it will take until the next fixed update, at which // point Unity physics will take over float timeuntilfixedupdate = ( Time.fixedDeltaTime + Time.fixedTime ) - Time.time; transform.position += timeuntilfixedupdate * velocity; float angle = Mathf.Rad2Deg * angularvelocity.magnitude; Vector3 axis = angularvelocity.normalized;

19 transform.rotation *= Quaternion.AngleAxis( angle * timeuntilfixedupdate, axis ); // private void HandAttachedUpdate( Hand hand ) if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; //Trigger got released if (!hand.getstandardinteractionbutton() ) // Detach ourselves late in the frame. // This is so that any vehicles the player is attached to // have a chance to finish updating themselves. // If we detach now, our position could be behind what it // will be at the end of the frame, and the object may appear // to teleport behind the hand when the player releases it. StartCoroutine( LateDetach( hand ) ); /*if ( attacheasein ) float t = Util.RemapNumberClamped( Time.time, attachtime, attachtime + snapattacheaseintime, 0.0f, 1.0f ); if ( t < 1.0f ) t = snapattacheaseincurve.evaluate( t ); transform.position = Vector3.Lerp( attachposition, attacheaseintransform.position, t ); transform.rotation = Quaternion.Lerp( attachrotation, attacheaseintransform.rotation, t ); else if (!snapattacheaseincompleted ) gameobject.sendmessage( "OnThrowableAttachEaseInCompleted", hand, SendMessageOptions.DontRequireReceiver ); snapattacheaseincompleted = true; */ // private IEnumerator LateDetach( Hand hand ) yield return new WaitForEndOfFrame(); hand.detachobject( gameobject, restoreoriginalparent ); //

20 private void OnHandFocusAcquired( Hand hand ) gameobject.setactive( true ); //velocityestimator.beginestimatingvelocity(); // private void OnHandFocusLost( Hand hand ) gameobject.setactive( false ); //velocityestimator.finishestimatingvelocity(); private void Start() Pickable //======= Copyright (c) Valve Corporation, All rights reserved. =============== // // Purpose: Basic throwable object // //============================================================== =============== using UnityEngine; using UnityEngine.Events; using System.Collections; using Valve.VR.InteractionSystem; // [RequireComponent( typeof( Charge ) )] [RequireComponent( typeof( Interactable ) )] [RequireComponent( typeof( Rigidbody ) )] [RequireComponent( typeof( VelocityEstimator ) )] public class Pickable : MonoBehaviour [EnumFlags] [Tooltip( "The flags used to attach this object to the hand." )] public Hand.AttachmentFlags attachmentflags = Hand.AttachmentFlags.ParentToHand Hand.AttachmentFlags.DetachFromOtherHand; [Tooltip( "Name of the attachment transform under in the hand's hierarchy which the object should should snap to." )] public string attachmentpoint; [Tooltip( "How fast must this object be moving to attach due to a trigger hold instead of a trigger press?" )] public float catchspeedthreshold = 0.0f; [Tooltip( "When detaching the object, should it return to its original parent?" )] public bool restoreoriginalparent = false;

21 public bool attacheasein = false; public AnimationCurve snapattacheaseincurve = AnimationCurve.EaseInOut( 0.0f, 0.0f, 1.0f, 1.0f ); public float snapattacheaseintime = 0.15f; public string[] attacheaseinattachmentnames; private VelocityEstimator velocityestimator; private bool attached = false; private float attachtime; private Vector3 attachposition; private Quaternion attachrotation; private Transform attacheaseintransform; public UnityEvent onpickup; public UnityEvent ondetachfromhand; public bool snapattacheaseincompleted = false; public Charge charge; public GameObject highlight; // void Awake() velocityestimator = GetComponent<VelocityEstimator>(); if ( attacheasein ) attachmentflags &= ~Hand.AttachmentFlags.SnapOnAttach; Rigidbody rb = GetComponent<Rigidbody>(); rb.maxangularvelocity = 50.0f; // private void OnHandHoverBegin( Hand hand ) if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; bool showhint = true; // "Catch" the throwable by holding down the interaction button instead of pressing it. // Only do this if the throwable is moving faster than the prescribed threshold speed, // and if it isn't attached to another hand if (!attached ) if ( hand.getstandardinteractionbutton() )

22 attachmentpoint ); Rigidbody rb = GetComponent<Rigidbody>(); if ( rb.velocity.magnitude >= catchspeedthreshold ) hand.attachobject( gameobject, attachmentflags, showhint = false; if ( showhint ) highlight.setactive(true); ControllerButtonHints.ShowButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); // private void OnHandHoverEnd( Hand hand ) if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; highlight.setactive(false); ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); // private void HandHoverUpdate( Hand hand ) if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; //Trigger got pressed if ( hand.getstandardinteractionbuttondown() ) hand.attachobject( gameobject, attachmentflags, attachmentpoint ); highlight.setactive(false); ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); // private void OnAttachedToHand( Hand hand ) if(hand.guesscurrenthandtype()!= Hand.HandType.Left)

23 return; charge.active = false; attached = true; onpickup.invoke(); hand.hoverlock( null ); Rigidbody rb = GetComponent<Rigidbody>(); rb.iskinematic = true; rb.interpolation = RigidbodyInterpolation.None; if ( hand.controller == null ) velocityestimator.beginestimatingvelocity(); attachtime = Time.time; attachposition = transform.position; attachrotation = transform.rotation; if ( attacheasein ) attacheaseintransform = hand.transform; if (!Util.IsNullOrEmpty( attacheaseinattachmentnames ) ) float smallestangle = float.maxvalue; for ( int i = 0; i < attacheaseinattachmentnames.length; i++ ) Transform t = hand.getattachmenttransform( attacheaseinattachmentnames[i] ); float angle = Quaternion.Angle( t.rotation, attachrotation ); if ( angle < smallestangle ) attacheaseintransform = t; smallestangle = angle; snapattacheaseincompleted = false; // private void OnDetachedFromHand( Hand hand ) if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return;

24 charge.active = true; attached = false; ondetachfromhand.invoke(); hand.hoverunlock( null ); Rigidbody rb = GetComponent<Rigidbody>(); if (!Simulation.Instance.Paused) rb.iskinematic = false; rb.interpolation = RigidbodyInterpolation.Interpolate; Vector3 position = Vector3.zero; Vector3 velocity = Vector3.zero; Vector3 angularvelocity = Vector3.zero; if ( hand.controller == null ) velocityestimator.finishestimatingvelocity(); velocity = velocityestimator.getvelocityestimate(); angularvelocity = velocityestimator.getangularvelocityestimate(); position = velocityestimator.transform.position; else velocity = Player.instance.trackingOriginTransform.TransformVector( hand.controller.velocity ); angularvelocity = Player.instance.trackingOriginTransform.TransformVector( hand.controller.angularvelocity ); position = hand.transform.position; Vector3 r = transform.transformpoint( rb.centerofmass ) - position; rb.velocity = velocity + Vector3.Cross( angularvelocity, r ); rb.angularvelocity = angularvelocity; // Make the object travel at the release velocity for the amount // of time it will take until the next fixed update, at which // point Unity physics will take over float timeuntilfixedupdate = ( Time.fixedDeltaTime + Time.fixedTime ) - Time.time; transform.position += timeuntilfixedupdate * velocity; float angle = Mathf.Rad2Deg * angularvelocity.magnitude; Vector3 axis = angularvelocity.normalized; transform.rotation *= Quaternion.AngleAxis( angle * timeuntilfixedupdate, axis ); // private void HandAttachedUpdate( Hand hand )

25 if(hand.guesscurrenthandtype()!= Hand.HandType.Left) return; //Trigger got released if (!hand.getstandardinteractionbutton() ) // Detach ourselves late in the frame. // This is so that any vehicles the player is attached to // have a chance to finish updating themselves. // If we detach now, our position could be behind what it // will be at the end of the frame, and the object may appear // to teleport behind the hand when the player releases it. StartCoroutine( LateDetach( hand ) ); if ( attacheasein ) float t = Util.RemapNumberClamped( Time.time, attachtime, attachtime + snapattacheaseintime, 0.0f, 1.0f ); if ( t < 1.0f ) t = snapattacheaseincurve.evaluate( t ); transform.position = Vector3.Lerp( attachposition, attacheaseintransform.position, t ); transform.rotation = Quaternion.Lerp( attachrotation, attacheaseintransform.rotation, t ); else if (!snapattacheaseincompleted ) gameobject.sendmessage( "OnThrowableAttachEaseInCompleted", hand, SendMessageOptions.DontRequireReceiver ); snapattacheaseincompleted = true; // private IEnumerator LateDetach( Hand hand ) yield return new WaitForEndOfFrame(); hand.detachobject( gameobject, restoreoriginalparent ); // private void OnHandFocusAcquired( Hand hand ) gameobject.setactive( true ); velocityestimator.beginestimatingvelocity();

26 // private void OnHandFocusLost( Hand hand ) gameobject.setactive( false ); velocityestimator.finishestimatingvelocity(); private void Start() ParallelFor using System.Collections.Generic; using System.Threading; namespace Gist public static class Parallel static AutoResetEvent[] _resets; public static void For(int frominclusive, int toexclusive, System.Action<int> body) var numthreads = 2 * System.Environment.ProcessorCount; if (_resets == null _resets.length!= numthreads) _resets = new AutoResetEvent[numThreads]; for (var i = 0; i < numthreads; i++) _resets [i] = new AutoResetEvent (false); var work = new WaitCallback ((i) => var ii = (int)i; var j = ii + frominclusive; for (var k = (int)j; k < toexclusive; k += numthreads) body ((int)k); _resets [ii].set (); ); lock (_resets) for (var i = 0; i < numthreads; i++) ThreadPool.QueueUserWorkItem (work, i); for (var i = 0; i < numthreads; i++) _resets [i].waitone (); public static void SerialFor(int frominclusive, int toexclusive, System.Action<int> body) for (var i = frominclusive; i < toexclusive; i++) body (i); ModifyController

27 using System.Collections; using System.Collections.Generic; using UnityEngine; public class ModifyController : MonoBehaviour public GameObject mod; // Update is called once per frame void Update () var ch = transform.find("controller_" + gameobject.name); if(ch!= null) var rm = ch.find("steamvr_rendermodel"); if (rm!= null) if(mod.name == "indicator") var _mod = rm.find(mod.name + "(Clone)"); if (_mod == null) Instantiate(mod, rm.transform.position, rm.transform.rotation, rm); else if(!_mod.gameobject.activeinhierarchy) _mod.gameobject.setactive(true); else var trackpad = rm.find("trackpad"); if (trackpad!= null) var _mod = trackpad.find(mod.name + "(Clone)"); if (_mod == null) Instantiate(mod, trackpad.transform.position, trackpad.transform.rotation, trackpad); Mathh using System.Collections; using System.Collections.Generic; using UnityEngine; public static class Mathh public static int Sign(int value) if (value < 0) return -1; return 1; GPUField using System; using System.Collections;

28 using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; public class GPUField : Singleton<GPUField> public struct ChargeStruct public Vector3 position; public int value; public ComputeShader computeshader; ComputeBuffer charges; ComputeBuffer positions; ChargeStruct[] chargesarr = new ChargeStruct[0]; int stridecharge; int stridevector3; int kernelindex; int warpcount; const int WARP_SIZE = 128; Vector3[] p; void Start() stridecharge = Marshal.SizeOf(typeof(ChargeStruct)); stridevector3 = Marshal.SizeOf(typeof(Vector3)); kernelindex = computeshader.findkernel("computefield"); charges = new ComputeBuffer(Simulation.Instance.passCount, stridecharge); positions = new ComputeBuffer(Simulation.Instance.passCount * 6 * 10, stridevector3); computeshader.setbuffer(kernelindex, "Charges", charges); computeshader.setbuffer(kernelindex, "Positions", positions); computeshader.setfloat("maxdistance", Simulation.Instance.maxDistance); computeshader.setfloat("k", Simulation.Instance.k); computeshader.setint("n", 10); computeshader.setfloat("linestep", 0.1f); public void GetPositions(ref Vector3[] positionsarr, ref ChargeStruct[] chargesarr) computeshader.setint("chargescount", chargesarr.length); charges.setdata(chargesarr); computeshader.dispatch(kernelindex, 1, 1, 1); positions.getdata(positionsarr);

29 protected override void OnDestroy() base.ondestroy(); if(charges!= null) charges.release(); if(positions!= null) positions.release(); ChargeParser using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; public class ChargeParser : Singleton<ChargeParser> public GameObject charge; // Use this for initialization void Start () if(file.exists("input.txt")) using (StreamReader sr = new StreamReader("input.txt")) int count = int.parse(sr.readline()); for (int i = 0; i < count; i++) string[] s = sr.readline().split(' '); int value = int.parse(s[0]); Vector3 position = new Vector3( float.parse(s[1]), float.parse(s[2]), float.parse(s[3]) ); var go = Instantiate(charge, position, Quaternion.identity); var ch = go.getcomponent<charge>(); ch.rb.iskinematic = false; ch.rb.interpolation = RigidbodyInterpolation.Interpolate; ch.active = true; ch.value = value; ch.init(); Simulation.Instance.AddCharge(ch); Charge using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events;

30 using Valve.VR.InteractionSystem; [RequireComponent(typeof(MeshRenderer))] public class Charge : MonoBehaviour 1]); private int _value; public int Value get return _value; set int abs = Mathf.Abs(value); if (abs > 4) throw new ArgumentOutOfRangeException("value"); transform.localscale = new Vector3 (scales[abs - 1], scales[abs - 1], scales[abs - if (value > 0) meshrenderer.material = positive; for (int i = 0; i < 6; i++) linerenderers[i].material = linepositive; else if (value < 0) meshrenderer.material = negative; for (int i = 0; i < 6; i++) linerenderers[i].material = linenegative; _value = value; public bool active = false; public Material positive; public Material negative; public Material linepositive; public Material linenegative; public Vector3 position get return transform.position; Rigidbody _rigidbody; public Rigidbody rb get if(_rigidbody == null) _rigidbody = GetComponent<Rigidbody>();

31 return _rigidbody; Vector3 velocity; Vector3 angularvelocity; public Vector3 acceleration get; set; public float[] scales = new float[] 0.045f, 0.065f, 0.095f, 0.12f ; public MeshRenderer meshrenderer; public Interactable interactable; public Pickable pickable; public LineRenderer[] linerenderers = new LineRenderer[6]; public UnityEvent onpickup; public int segments; public float step; float prevupdate = -1f; Vector3[,] prevpositions; Vector3[,] positions; Vector3[] current; private object _lock = new object(); public Charge() void Start() pickable.onpickup.addlistener(onpickup); public void Init() for (int i =0; i < 6; i++) linerenderers[i].enabled = true; //prevpositions = new Vector3[6, segments]; //positions = new Vector3[6, segments]; //current = new Vector3[segments]; void OnPickUp()

32 onpickup.invoke(); public void SaveVelocity() velocity = rb.velocity; angularvelocity = rb.angularvelocity; public void RestoreVelocity() rb.velocity = velocity; rb.angularvelocity = angularvelocity; public void UpdateLinesGPU(int i, ref Vector3[] positions) linerenderers[i].setpositions(positions); public void UpdateLines() UpdateLinesRealistic(); //UpdateLinesSimple(); public void UpdateLinesSimple() int n = linerenderers[0].positioncount; float linestep = 0.5f / n; Vector3 v; var positions = new Vector3[n]; positions[0] = transform.position; var other = Simulation.Instance.GetClosestCharge(this, this.position); //+Z v = new Vector3(0, 0, linestep); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(this, v).normalized * linestep; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(other, v).normalized * linestep; linerenderers[0].setpositions(positions); //+X v = new Vector3(lineStep, 0, 0); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(this, v).normalized * linestep; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(other, v).normalized * linestep;

33 linerenderers[1].setpositions(positions); //-Z v = new Vector3(0, 0, -linestep); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(this, v).normalized * linestep; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(other, v).normalized * linestep; linerenderers[2].setpositions(positions); //-X v = new Vector3(-lineStep, 0, 0); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(this, v).normalized * linestep; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(other, v).normalized * linestep; linerenderers[3].setpositions(positions); //-Y v = new Vector3(0, -linestep, 0); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(this, v).normalized * linestep; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(other, v).normalized * linestep; linerenderers[4].setpositions(positions); //+Y v = new Vector3(0, +linestep, 0); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(this, v).normalized * linestep; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(other, v).normalized * linestep; linerenderers[5].setpositions(positions);

34 public void UpdateLinesRealistic() int n = linerenderers[0].positioncount; float linestep = 0.5f / n; Vector3 v; var positions = new Vector3[n]; positions[0] = transform.position; //+Z v = new Vector3(0, 0, linestep); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; linerenderers[0].setpositions(positions); //+X v = new Vector3(lineStep, 0, 0); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; linerenderers[1].setpositions(positions); //-Z v = new Vector3(0, 0, -linestep); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; linerenderers[2].setpositions(positions); //-X v = new Vector3(-lineStep, 0, 0); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; linerenderers[3].setpositions(positions); //-Y v = new Vector3(0, -linestep, 0); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; linerenderers[4].setpositions(positions);

35 //+Y v = new Vector3(0, +linestep, 0); for (int i = 1; i < n; i++) positions[i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; linerenderers[5].setpositions(positions); public void InitLines() for (int i = 0; i < 6; i++) positions[i, 0] = transform.position; float linestep = 0.5f / segments; Vector3 v; v = new Vector3(0, 0, linestep); for (int i = 1; i < segments; i++) positions[0, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //+X v = new Vector3(lineStep, 0, 0); for (int i = 1; i < segments; i++) positions[1, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //-Z v = new Vector3(0, 0, -linestep); for (int i = 1; i < segments; i++) positions[2, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //-X v = new Vector3(-lineStep, 0, 0); for (int i = 1; i < segments; i++) positions[3, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //-Y v = new Vector3(0, -linestep, 0);

36 for (int i = 1; i < segments; i++) positions[4, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //+Y v = new Vector3(0, +linestep, 0); for (int i = 1; i < segments; i++) positions[5, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; StartCoroutine(UpdateLinesAsync()); IEnumerator UpdateLinesAsync() while (true) Array.Copy(positions, prevpositions, positions.length); if (Time.time - prevupdate >= step) for (int i = 0; i < 6; i++) positions[i, 0] = transform.position; float linestep = 0.5f / segments; Vector3 v; v = new Vector3(0, 0, linestep); for (int i = 1; i < segments; i++) positions[0, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //+X v = new Vector3(lineStep, 0, 0); for (int i = 1; i < segments; i++) positions[1, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //-Z v = new Vector3(0, 0, -linestep); for (int i = 1; i < segments; i++) positions[2, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep;

37 //-X v = new Vector3(-lineStep, 0, 0); for (int i = 1; i < segments; i++) positions[3, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //-Y v = new Vector3(0, -linestep, 0); for (int i = 1; i < segments; i++) positions[4, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; //+Y v = new Vector3(0, +linestep, 0); for (int i = 1; i < segments; i++) positions[5, i] = v; v -= Mathh.Sign(Value) * Simulation.Instance.GetField(v).normalized * linestep; prevupdate = Time.time; float t = (Time.time - prevupdate) / step; for (int i = 0; i < 6; i++) for (int j = 0; j < segments; j++) current[j] = Vector3.Lerp(prevPositions[i, j], positions[i, j], t); linerenderers[i].setpositions(current); yield return new WaitForEndOfFrame();

38

39

40

41

42

43

44

45

Русинович Андрей Сергеевич

Русинович Андрей Сергеевич Работа победителя заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Водные робототехнические системы» Русинович Андрей Сергеевич

More information

Бырков Аким Дмитриевич

Бырков Аким Дмитриевич Работа призера заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Виртуальная и дополненная реальность» Бырков Аким Дмитриевич Класс:

More information

Койляк Евгений Андреевич

Койляк Евгений Андреевич Работы победителя заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Большие данные и машинное обучение» Койляк Евгений Андреевич

More information

Section 28: 2D Gaming: Continuing with Unity 2D

Section 28: 2D Gaming: Continuing with Unity 2D Section 28: 2D Gaming: Continuing with Unity 2D 1. Open > Assets > Scenes > Game 2. Configuring the Layer Collision Matrix 1. Edit > Project Settings > Tags and Layers 2. Create two new layers: 1. User

More information

Pacman. you want to see how the maze was created, open the file named unity_pacman_create_maze.

Pacman. you want to see how the maze was created, open the file named unity_pacman_create_maze. Pacman Note: I have started this exercise for you so you do not have to make all of the box colliders. If you want to see how the maze was created, open the file named unity_pacman_create_maze. Adding

More information

ScaleForm/Unity A Simpler Tutorial by Carl Looper. July 2014

ScaleForm/Unity A Simpler Tutorial by Carl Looper. July 2014 ScaleForm/Unity A Simpler Tutorial by Carl Looper July 2014 Introduction The demo that ships with ScaleForm is way too complicated. While it certainly shows off some of the cool things that ScaleForm can

More information

Bonus Chapter 10: Working with External Resource Files and Devices

Bonus Chapter 10: Working with External Resource Files and Devices 1 Bonus Chapter 10: Working with External Resource Files and Devices In this chapter, we will cover the following topics: Loading external resource files using Unity default resources Loading external

More information

User Manual. Contact the team: Contact support:

User Manual.     Contact the team: Contact support: User Manual http://dreamteck.io https://www.facebook.com/dreamteckstudio Contact the team: team@dreamteck.io Contact support: support@dreamteck.io Discord Server: https://discord.gg/bkydq8v 1 Contents

More information

UNITY WORKSHOP. Unity Editor. Programming(Unity Script)

UNITY WORKSHOP. Unity Editor. Programming(Unity Script) July, 2018 Hayashi UNITY WORKSHOP Unity Editor Project: Name your project. A folder is created with the same name of the project. Everything is in the folder. Four windows (Scene, Project, Hierarchy, Inspector),

More information

UFO. Prof Alexiei Dingli

UFO. Prof Alexiei Dingli UFO Prof Alexiei Dingli Setting the background Import all the Assets Drag and Drop the background Center it from the Inspector Change size of Main Camera to 1.6 Position the Ship Place the Barn Add a

More information

NOTTORUS. Getting Started V1.00

NOTTORUS. Getting Started V1.00 NOTTORUS Getting Started V1.00 2016 1. Introduction Nottorus Script Editor is a visual plugin for generating and debugging C# Unity scripts. This plugin allows designers, artists or programmers without

More information

Vive Input Utility Developer Guide

Vive Input Utility Developer Guide using Valve.VR; public class GetPressDown_SteamVR : MonoBehaviour public SteamVR_ControllerManager manager; private void Update() // get trigger down SteamVR_TrackedObject trackedobj = manager.right.getcomponent();

More information

Terrain. Unity s Terrain editor islands topographical landscapes Mountains And more

Terrain. Unity s Terrain editor islands topographical landscapes Mountains And more Terrain Unity s Terrain editor islands topographical landscapes Mountains And more 12. Create a new Scene terrain and save it 13. GameObject > 3D Object > Terrain Textures Textures should be in the following

More information

C# in Unity 101. Objects perform operations when receiving a request/message from a client

C# in Unity 101. Objects perform operations when receiving a request/message from a client C# in Unity 101 OOP What is OOP? Objects perform operations when receiving a request/message from a client Requests are the ONLY* way to get an object to execute an operation or change the object s internal

More information

CE318/CE818: High-level Games Development

CE318/CE818: High-level Games Development CE318/CE818: High-level Games Development Lecture 1: Introduction. C# & Unity3D Basics Diego Perez Liebana dperez@essex.ac.uk Office 3A.527 2017/18 Outline 1 Course Overview 2 Introduction to C# 3 Scripting

More information

Mechanic Animations. Mecanim is Unity's animation state machine system.

Mechanic Animations. Mecanim is Unity's animation state machine system. Mechanic Animations Mecanim is Unity's animation state machine system. It essentially allows you to create 'states' that play animations and define transition logic. Create new project Animation demo.

More information

Introduction to Unity. What is Unity? Games Made with Unity /666 Computer Game Programming Fall 2013 Evan Shimizu

Introduction to Unity. What is Unity? Games Made with Unity /666 Computer Game Programming Fall 2013 Evan Shimizu Introduction to Unity 15-466/666 Computer Game Programming Fall 2013 Evan Shimizu What is Unity? Game Engine and Editor With nice extra features: physics engine, animation engine, custom shaders, etc.

More information

C# for UNITY3d: Sem 1 a.k.a. The Gospel of Mark Part 1

C# for UNITY3d: Sem 1 a.k.a. The Gospel of Mark Part 1 C# for UNITY3d: Sem 1 a.k.a. The Gospel of Mark Part 1 Special Thanks to Mark Hoey, whose lectures this booklet is based on Move and Rotate an Object (using Transform.Translate & Transform.Rotate)...1

More information

Adding a Trigger to a Unity Animation Method #2

Adding a Trigger to a Unity Animation Method #2 Adding a Trigger to a Unity Animation Method #2 Unity Version: 5.0 Adding the GameObjects In this example we will create two animation states for a single object in Unity with the Animation panel. Our

More information

+ Typed Message [Vlissides, 1998]

+ Typed Message [Vlissides, 1998] Background literature Introduction to Game Programming Autumn 2016 04. Game Programming Patterns and Techniques Juha Vihavainen University of Helsinki E. Gamma et al. (1994), Design Patterns: Elements

More information

if(input.getkey(keycode.rightarrow)) { this.transform.rotate(vector3.forward * 1);

if(input.getkey(keycode.rightarrow)) { this.transform.rotate(vector3.forward * 1); 1 Super Rubber Ball Step 1. Download and open the SuperRubberBall project from the website. Open the main scene. In it you will find a game track and a sphere as shown in Figure 1.1. The sphere has a Rigidbody

More information

Merging Physical and Virtual:

Merging Physical and Virtual: Merging Physical and Virtual: A Workshop about connecting Unity with Arduino v1.0 R. Yagiz Mungan yagiz@purdue.edu Purdue University - AD41700 Variable Topics in ETB: Computer Games Fall 2013 September

More information

Game Design From Concepts To Implementation

Game Design From Concepts To Implementation Game Design From Concepts To Implementation Giacomo Cappellini - g.cappellini@mixelweb.it Why Unity - Scheme Unity Editor + Scripting API (C#)! Unity API (C/C++)! Unity Core! Drivers / O.S. API! O.S.!

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Google SketchUp/Unity Tutorial Basics

Google SketchUp/Unity Tutorial Basics Software used: Google SketchUp Unity Visual Studio Google SketchUp/Unity Tutorial Basics 1) In Google SketchUp, select and delete the man to create a blank scene. 2) Select the Lines tool and draw a square

More information

Unity3D. Unity3D is a powerful cross-platform 3D engine and a user friendly development environment.

Unity3D. Unity3D is a powerful cross-platform 3D engine and a user friendly development environment. Unity3D Unity3D is a powerful cross-platform 3D engine and a user friendly development environment. If you didn t like OpenGL, hopefully you ll like this. Remember the Rotating Earth? Look how it s done

More information

IAT 445 Lab 10. Special Topics in Unity. Lanz Singbeil

IAT 445 Lab 10. Special Topics in Unity. Lanz Singbeil IAT 445 Lab 10 Special Topics in Unity Special Topics in Unity We ll be briefly going over the following concepts. They are covered in more detail in your Watkins textbook: Setting up Fog Effects and a

More information

PROTOTYPE 1: APPLE PICKER FOR UNITY 5.X

PROTOTYPE 1: APPLE PICKER FOR UNITY 5.X CHAPTER 28 PROTOTYPE 1: APPLE PICKER FOR UNITY 5.X In the pages below, I've replaced the sections of Chapter 28 that used GUIText with new pages that take advantage of the UGUI (Unity Graphical User Interface)

More information

Serial Filler. Copyright 2016 Christopher Stanley

Serial Filler. Copyright 2016 Christopher Stanley Serial Filler Copyright 2016 Christopher Stanley EasyNet is a serialization asset for Unity 5.1+. sequences of data a snap! It makes serializing and deserializing Examples In the Serial Filler\Examples

More information

Terrain. Unity s Terrain editor islands topographical landscapes Mountains And more

Terrain. Unity s Terrain editor islands topographical landscapes Mountains And more Terrain Unity s Terrain editor islands topographical landscapes Mountains And more 12. Create a new Scene terrain and save it 13. GameObject > 3D Object > Terrain Textures Textures should be in the following

More information

How to add new 3D Models to Machines Simulator 3 & Machines Simulator VR

How to add new 3D Models to Machines Simulator 3 & Machines Simulator VR How to add new 3D Models to Machines Simulator 3 & Machines Simulator VR In order to add you own 3D models to Machines Simulator 3 and MS VR software, you must follow the following steps: Download the

More information

IAP Manager. Easy IAP Workflow. Copyright all rights reserved. Digicrafts 2018 Document version Support

IAP Manager. Easy IAP Workflow. Copyright all rights reserved. Digicrafts 2018 Document version Support IAP Manager Easy IAP Workflow Copyright all rights reserved. Digicrafts 2018 Document version 1.7.0 Support email: support@digicrafts.com.hk A. Before Start In order to use the IAPManager, the following

More information

Spell Casting Motion Pack 5/5/2017

Spell Casting Motion Pack 5/5/2017 The Spell Casting Motion pack requires the following: Motion Controller v2.49 or higher Mixamo s free Pro Magic Pack (using Y Bot) Importing and running without these assets will generate errors! Overview

More information

Game Design Unity Workshop

Game Design Unity Workshop Game Design Unity Workshop Activity 2 Goals: - Creation of small world - Creation of character - Scripting of player movement and camera following Load up unity Build Object: Mini World and basic Chase

More information

Tutorial Physics: Unity Car

Tutorial Physics: Unity Car Tutorial Physics: Unity Car This activity will show you how to create a free-driving car game using Unity from scratch. You will learn how to import models using FBX file and set texture. You will learn

More information

Introduction to Game Programming Autumn Game Programming Patterns and Techniques

Introduction to Game Programming Autumn Game Programming Patterns and Techniques Introduction to Game Programming Autumn 2017 02. Game Programming Patterns and Techniques Juha Vihavainen University of Helsinki Background literature Erich Gamma et al. (1994), Design Patterns: Elements

More information

Massive Documentation

Massive Documentation Massive Documentation Release 0.2 Inhumane Software June 15, 2016 Contents 1 Introduction 3 1.1 Features.................................................. 3 1.2 Getting Started..............................................

More information

Programming Basics. Part 1, episode 1, chapter 1, passage 1

Programming Basics. Part 1, episode 1, chapter 1, passage 1 Programming Basics Part 1, episode 1, chapter 1, passage 1 Agenda 1. What is it like to program? 2. Our first code 3. Integers 4. Floats 5. Conditionals 6. Booleans 7. Strings 8. Built-in functions What

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Unity

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Unity i About the Tutorial Unity is a cross-platform game engine initially released by Unity Technologies, in 2005. The focus of Unity lies in the development of both 2D and 3D games and interactive content.

More information

public float timestart = -1; easingcuve = Easing.InOut; // Easing from Utils.cs

public float timestart = -1; easingcuve = Easing.InOut; // Easing from Utils.cs Letter.cs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 using UnityEngine;

More information

CE318: Games Console Programming

CE318: Games Console Programming CE318: Games Console Programming Lecture 1: Introduction. C# & Unity3D Basics Diego Perez dperez@essex.ac.uk Office 3A.526 2014/15 Outline 1 Course Overview 2 Introduction to C# 3 Scripting in C# for Unity3D

More information

is.centraldispatch Documentation

is.centraldispatch Documentation SPINACH is.centraldispatch Documentation July 27, 2016 Last Edit : July 27, 2016 Page I! of XII! IS.CENTRALDISPATCH DOCUMENTATION Getting Start Write Your First Multi-Threaded Script Using SPINACH.iSCentralDispatch

More information

Variables. Data Types.

Variables. Data Types. Variables. Data Types. The usefulness of the "Hello World" programs shown in the previous section is quite questionable. We had to write several lines of code, compile them, and then execute the resulting

More information

Massive Documentation

Massive Documentation Massive Documentation Release 0.2 Inhumane Software August 07, 2014 Contents 1 Introduction 3 1.1 Features.................................................. 3 1.2 Getting Started..............................................

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

Fundamentals. 5.1 What Will Be Covered in This Chapter. 5.2 Review

Fundamentals. 5.1 What Will Be Covered in This Chapter. 5.2 Review 5 Fundamentals Now that we ve covered most of the basic concepts and terms that are commonly taught to new programmers, it s time to learn some of the fundamental concepts that are required to write functioning

More information

Android Native Audio Music

Android Native Audio Music Android Native Audio Music Copyright 2015-2016 Christopher Stanley Android Native Audio Music (ANA Music) is an asset for Unity 4.3.4-5.x on Android. It provides easy access to the native Android audio

More information

Unity and MySQL. Versions: Unity 3.0.0f5; MySQL Author: Jonathan Wood. Alias: Zumwalt. Date: 10/8/2010. Updated: 10/12/2010 to include JS code

Unity and MySQL. Versions: Unity 3.0.0f5; MySQL Author: Jonathan Wood. Alias: Zumwalt. Date: 10/8/2010. Updated: 10/12/2010 to include JS code Versions: Unity 3.0.0f5; MySQL 5.2.28 Author: Jonathan Wood Alias: Zumwalt Date: 10/8/2010 Updated: 10/12/2010 to include JS code Document Version 1.0.1 Unity and MySQL Table of Contents Unity and MySQL...

More information

Using the API... 3 edriven.core... 5 A PowerMapper pattern... 5 edriven.gui... 7 edriven.gui framework architecture... 7 Audio... 9 Animation...

Using the API... 3 edriven.core... 5 A PowerMapper pattern... 5 edriven.gui... 7 edriven.gui framework architecture... 7 Audio... 9 Animation... 1 Using the API... 3 edriven.core... 5 A PowerMapper pattern... 5 edriven.gui... 7 edriven.gui framework architecture... 7 Audio... 9 Animation... 11 Tween class... 11 TweenFactory class... 12 Styling...

More information

Hex Map 22 Advanced Vision

Hex Map 22 Advanced Vision Catlike Coding Unity C# Tutorials Hex Map 22 Advanced Vision Smoothly adjust visibility. Use elevation to determine sight. Hide the edge of the map. This is part 22 of a tutorial series about hexagon maps.

More information

Unity Scripting 4. CS 491 / DES 400 Crea.ve Coding. Computer Science

Unity Scripting 4. CS 491 / DES 400 Crea.ve Coding. Computer Science Unity Scripting 4 Unity Components overview Particle components Interaction Key and Button input Parenting CAVE2 Interaction Wand / Wanda VR Input Devices Project Organization Prefabs Instantiate Unity

More information

7x3OgPqT4RgT0cp0fZvjs1_K-Q p9rinykwsnhaqhtjmnby92g

7x3OgPqT4RgT0cp0fZvjs1_K-Q   p9rinykwsnhaqhtjmnby92g ANEXOS ENLACES A LOS ANEXOS 1 Y 2. ANEXO 1: Eisenbahnbrücke's Nightmare (exportado). https://mega.nz/#!wdmbbrcb!88ujyuf_1umuarz1r 7x3OgPqT4RgT0cp0fZvjs1_K-Q ANEXO 2: Eisenbahnbrücke's Nightmare (proyecto

More information

points; // Stores the p0 & p1 for interpolation timestart; // Birth time for this Enemy_4 duration = 4; // Duration of movement

points; // Stores the p0 & p1 for interpolation timestart; // Birth time for this Enemy_4 duration = 4; // Duration of movement Enemy_4.cs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 using UnityEngine;

More information

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab. University of Technology Laser & Optoelectronics Engineering Department C++ Lab. Second week Variables Data Types. The usefulness of the "Hello World" programs shown in the previous section is quite questionable.

More information

Type Conversion. and. Statements

Type Conversion. and. Statements and Statements Type conversion changing a value from one type to another Void Integral Floating Point Derived Boolean Character Integer Real Imaginary Complex no fractional part fractional part 2 tj Suppose

More information

Game Design Unity Workshop

Game Design Unity Workshop Game Design Unity Workshop Activity 1 Unity Overview Unity is a game engine with the ability to create 3d and 2d environments. Unity s prime focus is to allow for the quick creation of a game from freelance

More information

Better UI Makes ugui Better!

Better UI Makes ugui Better! Better UI Makes ugui Better! version 1.1.2 2017 Thera Bytes UG Developed by Salomon Zwecker TABLE OF CONTENTS Better UI... 1 Better UI Elements... 4 1 Workflow: Make Better... 4 2 UI and Layout Elements

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

Quick Start - Simple Motions

Quick Start - Simple Motions Quick Start - Simple Motions While this document is about building motions using code, there is another option. If all you re really needing to do is trigger a simple animation or chain of animations,

More information

Better UI Makes ugui Better!

Better UI Makes ugui Better! Better UI Makes ugui Better! 2016 Thera Bytes UG Developed by Salomon Zwecker TABLE OF CONTENTS Better UI... 1 Better UI Elements... 4 1 Workflow: Make Better... 4 2 UI and Layout Elements Overview...

More information

Table of contents. Introduction. Having finally realized your ambitious plans for a game, you might face big performance

Table of contents. Introduction. Having finally realized your ambitious plans for a game, you might face big performance Table of contents Introduction Introduction... 1 Optimizing Unity games... 2 Rendering performance...2 Script performance...3 Physics performance...3 What is this all about?...4 How does M2HCullingManual

More information

Class Unity scripts. CS / DES Creative Coding. Computer Science

Class Unity scripts. CS / DES Creative Coding. Computer Science Class Unity scripts Rotate cube script Counter + collision script Sound script Materials script / mouse button input Add Force script Key and Button input script Particle script / button input Instantiate

More information

Introduction to Game Programming. 9/14/17: Conditionals, Input

Introduction to Game Programming. 9/14/17: Conditionals, Input Introduction to Game Programming 9/14/17: Conditionals, Input Micro-review Games are massive collections of what-if questions that resolve to yes or no Did the player just click the mouse? Has our health

More information

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations , 1 C#.Net VT 2009 Course Contents C# 6 hp approx. BizTalk 1,5 hp approx. No exam, but laborations Course contents Architecture Visual Studio Syntax Classes Forms Class Libraries Inheritance Other C# essentials

More information

using UnityEngine; using System.Collections; using System.Collections.Generic; // This enum contains the different phases of a game turn

using UnityEngine; using System.Collections; using System.Collections.Generic; // This enum contains the different phases of a game turn Bartok.cs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 using UnityEngine;

More information

Creating and Triggering Animations

Creating and Triggering Animations Creating and Triggering Animations 1. Download the zip file containing BraidGraphics and unzip. 2. Create a new Unity project names TestAnimation and set the 2D option. 3. Create the following folders

More information

C#: framework overview and in-the-small features

C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

Transforms Transform

Transforms Transform Transforms The Transform is used to store a GameObject s position, rotation, scale and parenting state and is thus very important. A GameObject will always have a Transform component attached - it is not

More information

Previously, on Lesson Night... From Intermediate Programming, Part 1

Previously, on Lesson Night... From Intermediate Programming, Part 1 Previously, on Lesson Night... From Intermediate Programming, Part 1 Struct A way to define a new variable type. Structs contains a list of member variables and functions, referenced by their name. public

More information

ANIMATOR TIMELINE EDITOR FOR UNITY

ANIMATOR TIMELINE EDITOR FOR UNITY ANIMATOR Thanks for purchasing! This document contains a how-to guide and general information to help you get the most out of this product. Look here first for answers and to get started. What s New? v1.53

More information

Augmented Feedback for Childhood Apraxia of Speech Design Specification Document

Augmented Feedback for Childhood Apraxia of Speech Design Specification Document Augmented Feedback for Childhood Apraxia of Speech Design Specification Document Document Version: 1.0 Status: Under revision Department of Computer Science & Engineering York University October 2013 Version

More information

PixelSurface a dynamic world of pixels for Unity

PixelSurface a dynamic world of pixels for Unity PixelSurface a dynamic world of pixels for Unity Oct 19, 2015 Joe Strout joe@luminaryapps.com Overview PixelSurface is a small class library for Unity that lets you manipulate 2D graphics on the level

More information

Intermediate. 6.1 What Will Be Covered in This Chapter. 6.2 Review

Intermediate. 6.1 What Will Be Covered in This Chapter. 6.2 Review 6 Intermediate Chapters 7 and 8 are big and dense. In many ways, they re exciting as well. Getting into a programming language means discovering many cool tricks. The basics of any programming language

More information

U9_Collision( 碰撞 ) 龍華科技大學多媒體與遊戲發展科學系林志勇編輯請勿外流轉載, 上傳網路 林志勇

U9_Collision( 碰撞 ) 龍華科技大學多媒體與遊戲發展科學系林志勇編輯請勿外流轉載, 上傳網路 林志勇 U9_Collision( 碰撞 ) 龍華科技大學多媒體與遊戲發展科學系編輯請勿外流轉載, 上傳網路 Audio AudioSource *.wav( 聲音檔 ) Audio Clip Play On Awake OnCollisionEnter function OnCollisionEnter(collision : Collision) { // Debug-draw all contact

More information

CHAPTER 23 FUNCTIONS AND PARAMETERS

CHAPTER 23 FUNCTIONS AND PARAMETERS CHAPTER 23 FUNCTIONS AND PARAMETERS 1 Topics Definition of a Function Function Parameters and Arguments Returning Values Returning void Naming Conventions Function Overloading Optional Parameters The params

More information

using UnityEngine; using System.Collections; using System.Collections.Generic;

using UnityEngine; using System.Collections; using System.Collections.Generic; EnemyBug.cs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 using

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Lecture 06 Sensor Systems Edirlei Soares de Lima Game AI Model Pathfinding Steering behaviours Finite state machines Automated planning Behaviour trees

More information

CSC Java Programming, Fall Java Data Types and Control Constructs

CSC Java Programming, Fall Java Data Types and Control Constructs CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference

More information

Review Questions for Final Exam

Review Questions for Final Exam CS 102 / ECE 206 Spring 11 Review Questions for Final Exam The following review questions are similar to the kinds of questions you will be expected to answer on the Final Exam, which will cover LCR, chs.

More information

ARTIFICIAL INTELLIGENCE: SITUATIONAL AWARENESS

ARTIFICIAL INTELLIGENCE: SITUATIONAL AWARENESS ARTIFICIAL INTELLIGENCE: SITUATIONAL AWARENESS So first of all before we start, we have to ask our self: What s is situational awareness exactly. A Quick google search reveals that: WHAT IS SITUATIONAL

More information

Better UI Makes ugui Better!

Better UI Makes ugui Better! Better UI Makes ugui Better! version 1.2 2017 Thera Bytes UG Developed by Salomon Zwecker TABLE OF CONTENTS Better UI... 1 Better UI Elements... 5 1 Workflow: Make Better... 5 2 UI and Layout Elements

More information

Unity Tutorial. Fall /15-666

Unity Tutorial. Fall /15-666 Unity Tutorial Fall 2014 15-466/15-666 Game World model, video, audio, interaction Often like Model-View-Controller Art, mechanics, levels, items, etc. Game Engine World model, video, audio, interaction

More information

OxAM Achievements Manager

OxAM Achievements Manager 1 v. 1.2 (15.11.26) OxAM Achievements Manager User manual Table of Contents About...2 Demo...2 Version changes...2 Known bugs...3 Basic usage...3 Advanced usage...3 Custom message box style...3 Custom

More information

Bonus Chapter 16 : Virtual Reality and Extra Features

Bonus Chapter 16 : Virtual Reality and Extra Features 1 Bonus Chapter 16 : Virtual Reality and Extra Features In this chapter, we will cover the following topics: Saving screenshots from the game Saving and loading player data using static properties Saving

More information

B.Sc. (Hons.) Computer Science I B.Sc. (Hons.) Electronics. (i) Runtime polymorphism and compile time polymorphism

B.Sc. (Hons.) Computer Science I B.Sc. (Hons.) Electronics. (i) Runtime polymorphism and compile time polymorphism [This question paper contains 6 printed pages.] Sr. No. of Question Paper 6065 D Your Roll No.... Unique Paper Code 2341011251305 N arne of the Course Name of the Paper Semester B.Sc. (Hons.) Computer

More information

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable Basic C++ Overview C++ is a version of the older C programming language. This is a language that is used for a wide variety of applications and which has a mature base of compilers and libraries. C++ is

More information

The Dark Arts of C# Delegates, Coroutines and other magic

The Dark Arts of C# Delegates, Coroutines and other magic The Dark Arts of C# Delegates, Coroutines and other magic (in a short space of time) feat. Keanu Reeves Spiderman Francois-Marie Arouet Anonymous Chuck Norris Dog Why this whirlwind tour? Experienced coders

More information

AIMS Embedded Systems Programming MT 2017

AIMS Embedded Systems Programming MT 2017 AIMS Embedded Systems Programming MT 2017 Object-Oriented Programming with C++ Daniel Kroening University of Oxford, Computer Science Department Version 1.0, 2014 Outline Classes and Objects Constructors

More information

Workshop BOND UNIVERSITY. Bachelor of Interactive Multimedia and Design. Asteroids

Workshop BOND UNIVERSITY. Bachelor of Interactive Multimedia and Design. Asteroids Workshop BOND UNIVERSITY Bachelor of Interactive Multimedia and Design Asteroids FACULTY OF SOCIETY AND DESIGN Building an Asteroid Dodging Game Penny de Byl Faculty of Society and Design Bond University

More information

Chart And Graph. Supported Platforms:

Chart And Graph. Supported Platforms: Chart And Graph Supported Platforms: Quick Start Folders of interest Running the Demo scene: Notes for oculus Bar Chart Stack Bar Chart Pie Chart Graph Chart Streaming Graph Chart Graph Chart Curves: Bubble

More information

Intel RealSense SDK Gesture Sequences Implemented in Unity* 3D

Intel RealSense SDK Gesture Sequences Implemented in Unity* 3D Intel RealSense SDK Gesture Sequences Implemented in Unity* 3D By Lynn Thompson When configuring gestures to control assets in a scene, it s important to minimize the complexity of the gestures and the

More information

FlowCanvas Offline Documentation.

FlowCanvas Offline Documentation. http://flowcanvas.paradoxnotion.com 1. Getting Started... 3 1.1. The FlowScript Controller... 3 1.2. Understanding the Flow... 4 1.3. Adding nodes... 5 1.4. Connecting Nodes... 7 1.5. The "Self" Parameter...

More information

Common Misunderstandings from Exam 1 Material

Common Misunderstandings from Exam 1 Material Common Misunderstandings from Exam 1 Material Kyle Dewey Stack and Heap Allocation with Pointers char c = c ; char* p1 = malloc(sizeof(char)); char** p2 = &p1; Where is c allocated? Where is p1 itself

More information

Vive Stereo Rendering Toolkit Developer s Guide

Vive Stereo Rendering Toolkit Developer s Guide Vive Stereo Rendering Toolkit Developer s Guide vivesoftware@htc.com Introduction Vive Stereo Rendering Toolkit provides drag-and-drop components for developers to create stereoscopic rendering effects

More information

Unity TicTacToe Tutorial Update

Unity TicTacToe Tutorial Update Unity TicTacToe Tutorial Update Step 4: Foundation game play There is clarification necessary to create the GridSpace C# script in the default PC installation as of 3/6/2018. When creating the GridSpace

More information

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class. 1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity

More information

Pong. Prof Alexiei Dingli

Pong. Prof Alexiei Dingli Pong Prof Alexiei Dingli Background Drag and Drop a background image Size 1024 x 576 X = 0, Y = 0 Rename it to BG Sorting objects Go to Sorting Layer Add a new Sorting Layer called Background Drag the

More information

Creating a 3D Characters Movement

Creating a 3D Characters Movement Creating a 3D Characters Movement Getting Characters and Animations Introduction to Mixamo Before we can start to work with a 3D characters we have to get them first. A great place to get 3D characters

More information

Airship Sub & Boat Tutorial. Made by King and Cheese

Airship Sub & Boat Tutorial. Made by King and Cheese Airship Sub & Boat Tutorial Made by King and Cheese Contents Introduction What you should already know 3 What you will learn 3 Let s start Opening up our scene 4 Adding some movement 5 Turning 8 Ascending

More information

Structured Data. CIS 15 : Spring 2007

Structured Data. CIS 15 : Spring 2007 Structured Data CIS 15 : Spring 2007 Functionalia HW4 Part A due this SUNDAY April 1st: 11:59pm Reminder: I do NOT accept LATE HOMEWORK. Today: Dynamic Memory Allocation Allocating Arrays Returning Pointers

More information