[flow_default] Transcription: 004 Calculating gravity.json
Browse files
transcriptions/004 Calculating gravity.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_file": "004 Calculating gravity.wav",
|
| 3 |
+
"text": "Okay, now the next thing that we're gonna need to do is calculate our gravity and also set the actual actor with these values that we've calculated. So what I'm gonna do is I'm gonna put event tick, where's my event tick? Oh, there we are, beautiful, thank you. Now I'm gonna do another sequence. And for the sake of debugging, because I wanna make sure that I'm actually setting the velocity of my actor properly and I wanna see it move, I'm gonna go with this then once, this is the second thing that's happening in the sequence. I'm gonna go down here, hit set, physics, linear velocity, on the plane model. Remember, that is the name of that mesh that I created over here. And then what I'm going to do is I'm actually going to take the forward velocity that we just calculated and the up velocity, which right now is going to be zero, but soon will have an actual value in it. And I'm gonna add them together. So, for velocity, up velocity. Move these down, add. Throw that into Nouvelle. These can be left the same. And then, cross your fingers. If I play, you can see that my plane is moving forward. Oh no, I'm gonna run into the mountain. Oh no! We can fix that, don't worry. In fact, that's actually expected behavior because once again, I haven't actually edited any of the other axes and bindings just forward and backwards. So this is great. Now, let's get started actually accurately simulating the gravity on my plane from this then one. So we need to make sure that if we are moving fast enough, gravity does not affect us. Not exactly how it works in the real world, but that'll do. So we're gonna go from our then zero and we're going to create a branch. This will allow us to stop the flow if we aren't over or under the condition. Now I'm going to grab my forward velocity. Get it. I'm going to then get the vector length of that forward velocity. This is kind of some Pythagorean theorem stuff. Of course, in more dimensions, that is not what I'm looking for. Boom. And I'm then going to make sure that that is less than the gravity threshold that we created. Hold this in. Last line, beautiful. This is making sure that if it is less, or if we are not moving fast enough, we're going to start applying gravity to our object. Now, let's say we're actually going fast enough that gravity shouldn't be affecting us. Well, even in that case, we still may have to change our upward velocity because if our downward velocity is already set and we start going fast enough, we need to slowly ramp up so that we start moving upwards like an actual plane would. Now we're going to do that with a v in TURP2. So I'm going to go down here. Awesome. And we're also going to get upwards velocity go directly into our current, right? And then our target is just going to be into a set node of velocity, which will be executed if this is false, meaning that we are going faster than our gravity threshold. Okay. The next thing we need to do is to actually set our upwards velocity in the case that we're moving faster than our gravity threshold. So we're going to go over from branch, draw it out, and set our upwards velocity. Great. Now we're going to set this based on some equations. And the first one is going to get our unrotated vector, or unrotated up vector. Now, if you think about it, right? If you rotate, and you're talking about up vector that's relative to your actor, to the object that you're talking about, that up is going to change angle. So you think about it if it rotates to the left. Up relative to that plane is going to be kind of up to the right, not really up straight. Now gravity doesn't work that way. Gravity always pulls you directly down towards the earth. So we need to get the vector pointing down towards the earth, not the vector pointing down from the bottom of the plane. To do that, we're gonna get get actor vector. Then we're gonna get actor rotation. And then we're going to use unrotate vector. Go here, here. Now we're going to multiply that by the result of another equation here. Now that equation is going to start with our forward velocity. I should say the length of our forward velocity, so I would get the length. In fact, again, if you drag out from a node, it gives you a menu with the nodes that fit the type of output. Now we're also going to need our gravity threshold, which we're going to get down here. And then we're going to divide that vector length by the gravity threshold. And then we're gonna put this into a LERP node, linear interpolate. Now, this is going to be the alpha. And the B is going to be negative 980. Now, if you've taken physics, you know that negative 9.8 is the acceleration of gravity. This is just that number normalized for unreal units, which are centimeters instead of meters. Now, we're going to take this return vector, plug it into the multiply node, plug the result of the unrotated vector into the other multiply input, and then drag that into the set field. Wait, I forgot something. I have minus here. Alt, click allows me to get rid of the pin. Subtract. And we are going to subtract one here once again. Boom. This is what we're gonna go back into the alpha. And boom, there we have it. Now let's test this, see if it's working. All right, so I'm going to slow down. And there we go. As you can see, once I reach that gravity threshold, I start approaching the ground. And I crash again. Not a surprise. Cool. Alright that means that we've got a working little blueprint here.",
|
| 4 |
+
"language": "en",
|
| 5 |
+
"confidence": null,
|
| 6 |
+
"duration": 614.14
|
| 7 |
+
}
|