1 using System.Collections;
2 using System.Collections.Generic;
8 using AVR.Core.Attributes;
10 namespace AVR.Motion {
44 public float snp_rotationAmount = 45;
50 public float snp_cooldown = 0.5f;
56 public float smt_rotationSpeed = 45;
69 if (IsOnline && !IsOwner)
return;
73 if(mode==
turnMode.SNAP && controller.inputManager.getEventStatus(turnEvent) && (stime + snp_cooldown) < Time.time) {
76 if (controller.inputManager.getEventStatus(turnDirection) < -0.5)
77 playerRig.transform.Rotate(Vector3.up, -snp_rotationAmount, Space.Self);
79 else if (controller.inputManager.getEventStatus(turnDirection) > 0.5)
80 playerRig.transform.Rotate(Vector3.up, snp_rotationAmount, Space.Self);
83 else if(mode==
turnMode.SMOOTH && controller.inputManager.getEventStatus(turnEvent)) {
85 if (controller.inputManager.getEventStatus(turnDirection) < -0.5)
86 playerRig.transform.Rotate(Vector3.up, -smt_rotationSpeed * Time.deltaTime, Space.Self);
88 else if (controller.inputManager.getEventStatus(turnDirection) > 0.5)
89 playerRig.transform.Rotate(Vector3.up, smt_rotationSpeed * Time.deltaTime, Space.Self);
Provides turning functionality to a controller.
turnMode
Mode of turning. Snap will instantly turn by a given amount while smooth is a continous turn over tim...
Sets the documentation html file inside of Packages/com.avr.core/Documentation/html of a given class...
AVR_ControllerInputManager.FloatEvent turnDirection
Float value that determines the direction of the turn.
AVR_Component specifically attatched to an AVR_Controller. Needs to have an AVR_Controller on this ga...
Allows for simple hiding of properties in the UnityEditor depending on certain conditions. For instance, in the following example the "type" field will only be displayed in the inspector if the "tracking" field is set to true:
AVR_ControllerInputManager.BoolEvent turnEvent
Event on which a turn is performed.