Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,280 --> 00:00:09,750
In this challenge review we're going to take a look at player rapping.
2
00:00:09,990 --> 00:00:11,550
So here's our pseudocode.
3
00:00:11,550 --> 00:00:16,380
And in order to do this properly I need to run our application and I need to know when exactly do we
4
00:00:16,380 --> 00:00:16,950
need to rap.
5
00:00:17,520 --> 00:00:22,080
So with the player selected in the hierarchy so they can see the detailed information in the inspector
6
00:00:22,470 --> 00:00:25,460
we're simply going to move all the way to the right.
7
00:00:25,950 --> 00:00:31,140
And as soon as I'm off the screen which is about eleven let's go on set to eleven.
8
00:00:31,140 --> 00:00:38,190
You can see a tad bit of me so I'm gonna set it to about eleven point four and that's two point two
9
00:00:39,030 --> 00:00:39,530
three.
10
00:00:39,540 --> 00:00:42,060
OK so on eleven point three.
11
00:00:42,060 --> 00:00:48,660
So if I move past eleven point three if I'm greater than eleven point three I need to appear at negative
12
00:00:48,870 --> 00:00:49,860
eleven point three.
13
00:00:50,010 --> 00:00:55,500
And likewise if I'm less than negative eleven point three I need to appear at positive eleven point
14
00:00:55,500 --> 00:00:56,610
three.
15
00:00:56,640 --> 00:00:59,090
So now that they have the value that I need to check against.
16
00:00:59,130 --> 00:01:01,720
Let's go ahead and write our if statements.
17
00:01:01,740 --> 00:01:04,090
So I'm going to convert this pseudocode into actual code.
18
00:01:04,110 --> 00:01:10,050
We're gonna have an if statement and I'm just going to check if the transform on The X so transform
19
00:01:10,050 --> 00:01:17,820
dot position dot x is greater than eleven point three f and if it is greater than one point three f
20
00:01:17,850 --> 00:01:19,120
what are we going to do.
21
00:01:19,260 --> 00:01:24,780
I need to take the current position in teleport him I need to say transform not position equals a new
22
00:01:24,780 --> 00:01:33,930
vector 3 the x axis is going to be negative eleven point three f followed by what for the Y I don't
23
00:01:33,930 --> 00:01:34,860
want it to be zero.
24
00:01:34,860 --> 00:01:39,090
It has to be whatever the current Y is I don't care what the Y is it's whatever the current Y is when
25
00:01:39,090 --> 00:01:40,260
the players wrapping.
26
00:01:40,440 --> 00:01:48,780
So we need to say transform dot position dot y to get the current value and then zero for Z inside of
27
00:01:48,780 --> 00:01:56,920
our l safe statement here we need to say elusive if we're gonna check for the left direction transformed
28
00:01:57,000 --> 00:02:04,560
up position x is less than negative eleven point three f then what needs to happen we need to grab our
29
00:02:04,560 --> 00:02:13,500
current position and assign it a new position to a positive eleven point three f for the X transformed
30
00:02:13,500 --> 00:02:20,460
our position dot y for the current Y in 0 4 Z by saving this and hopping back into unity
31
00:02:23,410 --> 00:02:29,920
you'll see here that if we run the game we should be pretty okay let's go ahead here make sure our bounds
32
00:02:29,920 --> 00:02:38,830
restraints are still working and looks like we're good and if I move all the way to the right here we
33
00:02:38,830 --> 00:02:46,540
wrap on the left and if I move all the way to the left we wrap on the right and there we go we have
34
00:02:46,540 --> 00:02:50,380
our fully functional player controller I'll see you guys in the next video.
3720
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.