Premium Only Content
Rogue Engine - Component Basics - In Two Minutes
Components in Rogue Engine enable you to add code to objects in your scene.
The Rogue Engine framework is built on top of the Three.js library. Any object in a Rogue scene can have code attached to it to use the power of Three.js. These bits of code are called components.
Here is a very simple example of a Rogue Engine component.
You can use the default cube for this example.
First right click in the Assets panel and create a new component. Components can be javascript or typescript. We will use typescript. Give it a name and confirm.
That will create a blank component in the asset panel.
If you double click this icon it will open up in your default code editor. If you don't have one installed I would recommend downloading Visual Studio Code from Microsoft.
The blank component already has somethings set up. All components import the Rogue Engine
The component already has its class Export set up and three methods, awake, start and update. For this example we just need the update method.
We are going to rotate the cube in the scene so in the update method that runs each time the screen updates, we can write this.object3d.rotateY and then give it an angle.
This is fine but we don't know how fast the scene is updating so if we want to keep the rotation consistent whatever speed the scene is running, we can ask Rogue how long since the last update and use that value.
We get this delta value by reading RE.Runtime.deltaTime.
So that's our code - save it and go back to the Rogue Editor.
If we run our scene without the component attached to the cube, nothing happens. But if we add the component to the cube by dragging and dropping it and then run the scene, you will see that the cube rotates smoothly.
So that's how you add a basic component to an object in Rogue Engine.
-
1:31:05
Kim Iversen
3 days agoShe Predicted Putin Would Invade Ukraine – What Happens Next Is Terrifying | Rebekah Koffler
93.7K119 -
1:04:51
Bright Insight
8 hours agoWhat I Didn't Say to Joe Rogan on his Podcast
78.5K46 -
1:04:02
Talk Nerdy 2 Us
12 hours agoPhishing Scams, Satellite Phones & Piracy Networks: Cybercrime's Next Leve
21.3K1 -
2:14:38
I_Came_With_Fire_Podcast
10 hours agoLive Fire (No Exercise)
38.4K2 -
1:05:52
Havoc
9 hours agoThankful | Stuck Off the Realness Ep. 21
78.3K3 -
2:05:40
Roseanne Barr
12 hours ago $66.97 earnedThe Perverse Reverse | The Roseanne Barr Podcast #76
126K185 -
1:36:41
Flyover Conservatives
1 day agoThink Texas and Florida are the Best? Think Again… - Lt. Governor Matt Pinnell; Leaky Gut, Dyslexia, ADHD, Eye Connection - Dr. Troy Spurrill | FOC Show
57.7K2 -
35:40
TheTapeLibrary
20 hours ago $4.71 earnedThe Priest Murders & The Mystery of William Toomey
44.1K7 -
1:29:16
Adam Does Movies
9 hours ago $4.98 earnedAwful New Christmas Movies! - Dear Santa - Our Little Secret - Nutcrackers - LIVE!
41.6K5 -
3:16:05
Nerdrotic
13 hours ago $36.03 earnedWoke Killed Comedy, Hollywood Infighting, Girlboss Rohirrim | Friday Night Tights 330 w/ It'sAGundam
133K31