Premium Only Content
![Rogue Engine - Component Basics - In Two Minutes](https://1a-1791.com/video/s8/1/4/N/d/Q/4NdQk.qR4e-small-Rogue-Engine-Component-Basi.jpg)
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.
-
2:41:39
TimcastIRL
10 hours agoDOGE IS IN THE IRS, Democrats Launch 14 Lawsuits To STOP Trump & Elon w/Nate Cain | Timcast IRL
182K109 -
2:04:28
Kim Iversen
12 hours agoTHE SHAKEUP BEGINS! What Will RFK Jr Do In His First Few Days As HHS Secretary?
86.1K100 -
1:13:58
The Charlie Kirk Show
9 hours agoTHOUGHTCRIME Ep. 73 — Tattoo Vibe Shift? RFK's Day 1 Agenda? Subway Speakerphone Ban?
153K52 -
26:10
Mrgunsngear
12 hours ago $5.05 earnedRomanian RPK Review: The Warsaw Pact's M249 SAW
44.1K6 -
1:52:40
StaleSavage
10 hours agoCrows Nest Gaming Community
113K2 -
51:17
Man in America
15 hours ago🚨 CCP’s SECRET WAR on America—Military Insider Sounds the ALARM! w/ Matthew Newgent
68.4K33 -
6:53:51
SpartakusLIVE
12 hours ago#1 HACKER gets UNBANNED || The MASSES Rejoice, The Accusers TRIGGERED
88.4K1 -
54:33
Flyover Conservatives
1 day agoThe #1 Mistake Singles Make That Keeps Them Alone Forever - Jackie Dorman | FOC Show
70.7K4 -
1:06:32
PMG
1 day ago $3.15 earned"372 Duodecillion Possibilities: COVID Complexities & Long COVID Remedies w/ Dr. Bryan Ardis"
37.9K6 -
1:06:41
Donald Trump Jr.
15 hours agoDOGE Keeps Digging as Dems Keep Deceiving, Live with Lawyer Paul Moore & Entrepreneur Barry Habib | Triggered Ep. 216
155K98