April 2020
Intermediate to advanced
716 pages
18h 55m
English
We want to add a feature that starts rotating a 3D object around its y axis whenever a player focuses on the 3D object, that is, when the platform cursor begins intersecting with the Entity component rendering the specific 3D object.
We will update the Entity component from the previous section to add the onEnter and onExit handlers, as shown in the following code:
/MERNVR/index.js
<Entity ... onEnter={this.rotate(i)} onExit={this.stopRotate}/>
The object rendered with this Entity component will start rotating on a cursor entry or focus on the object, and it will stop when the platform cursor exits the object and is no longer in the player's focus. In the following section, we will discuss the implementation of this ...
Read now
Unlock full access