====== Condition and timing of event function calls ====== ===== Update ===== ==== update() ==== * The owner of VCI * Every frame Remarks * The owner of VCI and the owner of SubItem are different * [Public studio only] The owner of the VCI is the first joiner to the room * [Public studio only] When the owner of the VCI leaves the room, the ownership will be transferred to another user (in order of room join) ==== updateAll() ==== * All users * Frames ===== Trigger/Collision and Enter/Exit ===== ==== onTriggerEnter(item, hit) ==== * Owner of SubItem * When Trigger collides Remarks * A SubItem without ownership will have its Rigidbody turned to Kinematic=true * For the difference in the firing of Trigger events with Kinematic=true/false, refer to Collision action matrix from the link below * https://docs.unity3d.com/2018.3/Documentation/Manual/CollidersOverview.html * The Collider has isTrigger true (SubItem itself doesn't have to have Rigidbody) ==== onTriggerExit(item, hit) ==== * Owner of SubItem * When Trigger was disengaged Remarks * SubItem without the ownership will have its Rigidbody turned to Kinematic=true * For the difference in the firing of Trigger events with Kinematic=true/false, refer to Collision action matrix from the link below * https://docs.unity3d.com/2018.3/Documentation/Manual/CollidersOverview.html * The Collider has isTrigger true (SubItem itself doesn't have to have Rigidbody) ==== onCollisionEnter(item, hit) ==== * Owner of SubItem * When Collier collides Remarks * A SubItem without ownership will have its Rigidbody turned to Kinematic=true * For the difference in the firing of Trigger events with Kinematic=true/false, refer to Collision action matrix from the link below * https://docs.unity3d.com/2018.3/Documentation/Manual/CollidersOverview.html * isTrigger for the Collider is false + The SubItem have to have Rigidbody ==== onCollisionExit(item, hit) ==== * Owner of SubItem * When collision was disengaged Remarks * A SubItem without ownership will have its Rigidbody turned to Kinematic=true * For the difference in the firing of Trigger events with Kinematic=true/false, refer to Collision action matrix from the link below * https://docs.unity3d.com/2018.3/Documentation/Manual/CollidersOverview.html * isTrigger for the Collider is false + The SubItem have to have Rigidbody ===== Grab and Use ===== * In Virtual Cast, an action of grabbing is used as a trigger to transfer an ownership This means the following states could occur: * Grabbing * Not having ownership (Other user grabbed the item you own. Requesting the ownership) * The grab event doesn't happen * Grabbing * Not having ownership (Ownership of the item you are grabbing has been transferred to another user who grabbed the item) * The ungrab event that is supposed to happen after this does not happen. To counter this, Virtual Cast judges the conditions for Grab and Use events as shown below. ==== onGrab(target) ==== * Owner of SubItem * Have ownership before grabbing * When grabbed * Received ownership after grabbing * When received ownership Remarks * The event might fire a few moments later after being grabbed ==== onUngrab(target) ==== * When ungrabbed * Or when lost ownership (Won't have ownership during the script run) Remarks * The event might fire when you lost the ownership, even while you are holding the item ==== onUse(use) ==== * Owner of SubItem * When you pressed the Use button ==== onUnuse(use) ==== * When you released the Use button * Or when lost ownership (Won't have ownership during the script run) Remarks * The event could fire when you lost the ownership even while you are holding the button