Controls

Three.js and WebGL 3D Programming Crash Course Three.js & WebGL 3D Programming
4 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€65.86
List Price:  €94.09
You save:  €28.23
£56.23
List Price:  £80.33
You save:  £24.10
CA$96.56
List Price:  CA$137.95
You save:  CA$41.39
A$109.12
List Price:  A$155.90
You save:  A$46.77
S$95.51
List Price:  S$136.45
You save:  S$40.93
HK$548.13
List Price:  HK$783.08
You save:  HK$234.94
CHF 63.91
List Price:  CHF 91.31
You save:  CHF 27.39
NOK kr769.36
List Price:  NOK kr1,099.13
You save:  NOK kr329.77
DKK kr491.41
List Price:  DKK kr702.04
You save:  DKK kr210.63
NZ$118.95
List Price:  NZ$169.94
You save:  NZ$50.98
د.إ257.03
List Price:  د.إ367.20
You save:  د.إ110.17
৳7,677.69
List Price:  ৳10,968.60
You save:  ৳3,290.91
₹5,852.52
List Price:  ₹8,361.11
You save:  ₹2,508.58
RM335.39
List Price:  RM479.15
You save:  RM143.76
₦84,069.65
List Price:  ₦120,104.65
You save:  ₦36,035
₨19,458.35
List Price:  ₨27,798.84
You save:  ₨8,340.48
฿2,566.81
List Price:  ฿3,667.03
You save:  ฿1,100.22
₺2,274.04
List Price:  ₺3,248.77
You save:  ₺974.73
B$362.90
List Price:  B$518.45
You save:  B$155.55
R1,334.09
List Price:  R1,905.92
You save:  R571.83
Лв128.84
List Price:  Лв184.07
You save:  Лв55.22
₩97,476.14
List Price:  ₩139,257.60
You save:  ₩41,781.46
₪264.05
List Price:  ₪377.23
You save:  ₪113.18
₱3,986.52
List Price:  ₱5,695.28
You save:  ₱1,708.75
¥10,820.22
List Price:  ¥15,458.12
You save:  ¥4,637.90
MX$1,176.64
List Price:  MX$1,680.99
You save:  MX$504.34
QR256.17
List Price:  QR365.97
You save:  QR109.80
P968.93
List Price:  P1,384.25
You save:  P415.31
KSh9,203.68
List Price:  KSh13,148.68
You save:  KSh3,945
E£3,396.13
List Price:  E£4,851.82
You save:  E£1,455.69
ብር3,996.71
List Price:  ብር5,709.83
You save:  ብር1,713.12
Kz58,375.11
List Price:  Kz83,396.59
You save:  Kz25,021.47
CLP$68,085.57
List Price:  CLP$97,269.27
You save:  CLP$29,183.70
CN¥506.62
List Price:  CN¥723.78
You save:  CN¥217.15
RD$4,150.97
List Price:  RD$5,930.22
You save:  RD$1,779.24
DA9,438.91
List Price:  DA13,484.73
You save:  DA4,045.82
FJ$159.47
List Price:  FJ$227.82
You save:  FJ$68.35
Q544.72
List Price:  Q778.21
You save:  Q233.48
GY$14,635.04
List Price:  GY$20,908.09
You save:  GY$6,273.05
ISK kr9,925.28
List Price:  ISK kr14,179.58
You save:  ISK kr4,254.30
DH711.08
List Price:  DH1,015.88
You save:  DH304.79
L1,245.82
List Price:  L1,779.82
You save:  L534
ден4,054.16
List Price:  ден5,791.90
You save:  ден1,737.74
MOP$564.11
List Price:  MOP$805.91
You save:  MOP$241.79
N$1,331.93
List Price:  N$1,902.84
You save:  N$570.91
C$2,585.77
List Price:  C$3,694.12
You save:  C$1,108.34
रु9,338.47
List Price:  रु13,341.25
You save:  रु4,002.77
S/260.34
List Price:  S/371.93
You save:  S/111.59
K265.89
List Price:  K379.86
You save:  K113.97
SAR262.53
List Price:  SAR375.07
You save:  SAR112.53
ZK1,761.48
List Price:  ZK2,516.51
You save:  ZK755.02
L327.75
List Price:  L468.24
You save:  L140.48
Kč1,662.75
List Price:  Kč2,375.47
You save:  Kč712.71
Ft26,013.66
List Price:  Ft37,163.97
You save:  Ft11,150.30
SEK kr766.89
List Price:  SEK kr1,095.61
You save:  SEK kr328.71
ARS$60,771.68
List Price:  ARS$86,820.40
You save:  ARS$26,048.72
Bs485.46
List Price:  Bs693.54
You save:  Bs208.08
COP$270,888.64
List Price:  COP$387,000.37
You save:  COP$116,111.72
₡35,184.52
List Price:  ₡50,265.75
You save:  ₡15,081.23
L1,734.30
List Price:  L2,477.69
You save:  L743.38
₲518,216.96
List Price:  ₲740,341.68
You save:  ₲222,124.71
$U2,722.73
List Price:  $U3,889.78
You save:  $U1,167.05
zł285.58
List Price:  zł407.99
You save:  zł122.40
Already have an account? Log In

Transcript

Hello, in this video we are going to cover implementing a control system into our free j s scene. Thankfully, there are a bunch of libraries out there that we can utilize will be utilized one called orbit controls, log said there are a bunch of them. And to see how to use it, go to the free JS website, go to examples, type in controls, you can see the different types I can do more of a pointer lock. So this is locked to a point and I've moved backwards and forwards or really cool stuff, sort of like a first person shooter. Let's get to that. You can do a slice or a method so it's following the camera and I can move in and out.

So so this is really cool. So you can do role in this. This will be great for a space game, but we're going to be looking at the obesity Stop, which is a fantastic simple control system really easy to implement, and is very useful for navigating our scene. So to use this, first of all, you want to make sure you have free JS download it, you most likely go download it, if you delete it, make sure you download it again, because on the part of free j s, you get a bunch of different files. If you go to examples, scroll down to J s, then go to controls, then go to ob controls, just copy that, go to your project. paste that into the J s folder.

And now what we want to do, as you can see, it's in the J s folder, what we want to do is include this file, so right here, correct source code j s for slash ob control Oh, that didn't work for a bit Ctrl J s. And now we've got it included. to actually implement it, it's really simple. All you have to do is controls equals new, free dot o bit. Controls, give it two parameters. First is the camera. And the next is the DOM element from the renderer.

So renderer dot DOM element, save that, we go to our web browser refresh. We can actually move this around. That's really cool. We can zoom in and out. So I'll keep the left mouse button clicked. And I can rotate our world It looks like we're just rotating the scene.

But if I were to pan using the right mouse button. You can see I'm not rotating just one object, I'm rotating around the center point and that this is also rotating around, well, the set top central point and zoom in and out, but keeping the middle mouse button pressed, I mean scroll wheel pressed, and then just zoom in just moving my mouse backwards and forwards. The one I'm going to do is finally just disable rotation to get a better understanding of what is happening because it's sort of counterintuitive. As you can see, we can rotate around our object, we can plan our object. So this is a great way of just navigating our scene. So imagine if I wanted to go a little closer to this corner.

I'm gonna look close. I'm looking at it. I'm happy with a corner, zoom back out, have a look at a view like this. And yes, I'm very happy with what we got. So this is just a Really quick introduction into control systems in free j s. Like I said, we go to the free j s dot o website, go to examples, type in controls and have a look at all the different control systems. You can use the control system view source and actually have a look at what file it needs to tell you where to get it from and how to implement it.

Most of them are usually one or two lines of code which is fantastic. If you have any questions, feel free to ask us and we will respond we we are like that. And as usual. Thanks for watching. I hope you have a great day.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.