PDA

View Full Version : PneumaticBog484's YouTube



PneumaticBog484
06-21-2015, 12:59 PM
YouTube Channel: https://www.youtube.com/channel/UCcHcW_Y8-Q3hNuhpFBVtO-w



SCRIPTS

Click "Show" on the Spoiler tag to read the full script

3D Coordinate & Rotation System
1. Setup
To begin, you should change some Editor Settings. Hold down on the D-Pad and select Editor Settings in the bottom right corner. Turn on the Editor Mini Map and make sure Snap X, Y, and Z are all selected. Change your Snap Distance to exactly 1.00 m, then, back out of the Editor Settings.
For this tutorial you need to angle yourself to the "Standard Orientation". In Fusion, you need to face the mountains at the bottom of the mini map. In Evolution, you need to face the left side of the mini map. If you are confused as to what direction you need to face, spawn in a Yellow Custom Camera and press the Snap button twice. On Xbox, click Right Stick two times. The Yellow Camera will be set to the "Standard Orientation", so that you can angle yourself likewise.

2. X & Y Axis
The Trials coordinate system is in all respects a Cartesian coordinate system. This is same system that most of you learned in school. The first two axes are the X and Y axis. To visualize the two axes, I have made a small demonstration here. These two toolcards are Object Info Data Sources. They will tell us the position of our yellow camera. The X Axis extends infinitely in both direction horizontally, and the Y Axis extends infinitely in both directions vertically. The two axes work in the same way you have learned. The X coordinate of an object increases as the object is moved to the right, and the X coordinate decreases as the object is moved to the left. The same applies for the Y Axis; the Y coordinate increases as the object is moved up, and the Y coordinate decreases as the object is moved down. Since our Snap distance is set to 1.00 exactly, Snapping this sphere will place it on integer coordinates. Now it is at (3, 102). You may notice that the base of my graph is at (0, 100), and not (0, 0), the origin. This is because the Y coordinate zero is located deep underground and it is impractical to build that far down. For this reason, I suggest getting used to seeing Y coordinates greater than 100. Almost all terrain in the Trials World is above the Y coordinate of 100.

3. Z Axis
Three Dimensional systems by definition have three axes. In Trials, this third axis is called the Z axis. The Z axis extends infinitely in both directions forward and backward. In other settings this axis may also be referred to as the Depth axis, since it measures distances receding into a three dimensional space. I've added another Object Info Data Source here that will tell us the Z Position of our yellow camera. In Trials the Z coordinate increases as the object moves further away or forward in the world, and the Z coordinate decreases as the object moves closer or backward in the world. If you have never heard of this third Z axis before, this all may seem very confusing to you, I know it was very confusing to me at first. The best thing I can recommend is to pause the video and try to imagine the three axes, draw them out on paper, or find a cube. A cube is a wonderful example of these three dimensions since it has perpendicular, square sides.

4. 3D Rotation
The X, Y, and Z coordinate axes are static in the Trials world. Turning yourself around doesn't change their orientation. They always remain facing in the same direction. All objects in the Trials world have coordinates on this system. You can view these coordinates with Object Info Data Sources, like I have here. Objects don't have just a position though, they also have a rotation. You probably have rotated an object before using the three rings that encircle it. These rings are useful for turning an object, but they do not represent how angles are calculated in Trials. Angles are calculated using three distinct rotation axes. They are based upon Tait-Bryan angles also called Nautical angles since they are used on ships and aircraft. Not all 3D games and engines use Tait-Bryan angles, but they are a useful and practical way to understand 3D rotation.

5. Yaw
The first rotation axis, the most basic of the three, is called the Yaw. Under the Object Info Data Source it is known as Angle X, but I will refer to it as Yaw. It rotates around the Y Axis. The Yaw of an object increases when the object is rotated counter-clockwise, and the Yaw decreases when the object is rotated clockwise. You'll notice that the Data Source says that this camera has a Yaw of 180 degrees, even though it is at the "Standard Orientation". This angle measure is correct, but it will mess up the understanding of our other two rotation axes. For this reason, I will use a Two Input Operator to subtract 180 degrees from the Angle X. This way, when an object has "Standard Orientation" it will have a Yaw of 0 degrees.

6. Pitch
The second rotation axis is called the Pitch. Under the Object Info Data Source it is known as Angle Y, but I will refer to it as Pitch. Just like our Yaw, we need to modify it to understand it in a useful way. I will use the Two Input Operator again, but this time subtract the Angle Y from 180 to get 0 degrees. Pitch initially rotates around the X Axis, but it actually follows the Yaw rotation axis. Unlike the three coordinate axes, X, Y, and Z which are all static, the rotation axis for Pitch rotates WITH the Yaw. The Yaw rotation axis however, does NOT rotate with the Pitch. This can be a difficult concept to understand. I will demonstrate what happens with these rings I have built. If I rotate my red Yaw ring, then the green Pitch ring rotates with it. But if I rotate the green Pitch ring, the red Yaw ring will not rotate with it. Each change to the Yaw axis effects the Pitch axis, but each change to the Pitch axis does not effect the Yaw axis. Watch the Yaw of the yellow camera as I Pitch the camera up and down. It does not change, but the Pitch does. The Pitch increases when the camera is rotated downward, and decreases when the camera is rotated upward.

7. Bank
The third and final rotation axis is called the Bank. Under the Object Info Data Source it is known as Angle Z, but I will refer to it as Bank. As with our Yaw and Pitch, we have to modify it to understand it in a useful way. I will use the Two Input Operator to subtract 180 from Angle Z, so that our Bank is 0 degrees at "Standard Orientation". Bank initially rotates around the Z Axis, but it truly follow the Pitch rotation axis. The Bank rotation axis rotates with the Pitch. This means modifications to the Yaw change the Pitch axis, which changes the Bank axis. If I rotate my red Yaw ring, then both the green Pitch ring and the blue Bank ring rotate with it. If I rotate green Pitch ring, only the blue Bank ring rotates with it. Finally the blue Bank ring is rotated on its own. It does not affect any of the other rotation axes. The Bank axis follows the Pitch in the same way that the Pitch axis follows the Yaw. Watch the Two Input Operators as I rotate the camera again. The Yaw is rotated first, followed by the Pitch, and finally the Bank. From the perspective of the camera, the Bank increases when the camera is rotated clockwise and the Bank decreases when the camera is rotated counter-clockwise.

8. Memorizing
Remembering how the rotation system works can be difficult, so I suggest connecting it with a real life example. The two that helped me were an airplane and a weapons turret. An airplane can be Yawed left and right, then it is Pitched up and down, and finally it is Banked or Rolled side to side. Similarly a turret can swivel on it Yaw axis, raise its Pitch, and then spin on its Bank axis.

9. Using the System
The reason the coordinate and rotation system is so important is because it is used in the Object Position Event. The Object Position Event allows you to move and rotate objects anywhere in the Trials World during play, giving you the ability to create complex animations for your track or create whole new games inside Trials. To use the Object Position Event with our global coordinate and rotation system, deselect Local for both Position and Rotation. Select Set Rotation under the Rotation section to set the object to a global rotation. A useful feature of the Object Position Event is that it can get our object's current location. Hover over each of the Positions, X, Y, and Z, and press the indicated button. On Xbox press X; on Playstation press Square. Leave each rotation angle as zero. If we check our track now by pressing the Physic's button, the camera will be moved to its current position, meaning it won't be moved at all, and it will be rotated to the "Standard Orientation" of 0 degrees Yaw, 0 degrees Pitch, and 0 degrees Bank. If I assign the Yaw of the Object Position Event to this Curve Data Source, which loops between the values of 0 and 360, our camera will spin 360 degrees on its Yaw axis. Remember that an increase in Yaw rotates counter-clockwise when viewed from above. If I assign the Pitch of the Object Position Event to this second Curve Data Source, which oscillates between the values of -40 and 40, our camera will be Pitched up and down as it rotates around the Yaw axis. Watch the cameras rotation closely. It always spins in a counter clockwise motion, but it also Pitches up and down. Finally, if I assign the Bank of the Object Position Event to this third Curve Data Source, which loops between the values of 0 and 360, our camera will roll 360 degrees around its Bank axis, while it is Pitched and Yawed. Notice the rotation of camera. It always rotates in a counter clockwise direction around the Yaw axis, and it always Pitches up and down. The spin of the Bank axis does not effect the other two rotation axes.

FPS #2 Jumping
1. Area Trigger
The first object we need is an Area Trigger. Spawn one in from the Triggers & Events - Triggers section. Snap it near your other objects; remember to press Right Stick twice to snap the angles of the object. This Area Trigger is going to detect when we are standing on solid ground.

Open up the Object Properties of the Area Trigger. Turn on Physics since we want to detect collision. Objects can only detect collision when Physics is on. We're now going to change some things under Advanced Physics. We only need this Area Trigger for collision, so we don't want it to move by itself. These next few settings are going to do that. Set the Mass to 0.1 kilograms, set the Friction to 0, set the Linear Damping to 0, set the Angular Damping to 0, select Disable Global Damping, set the Restitution to 0, set the Buoyancy to 0, select Disable World Gravity, and set the Object Gravity to -1. These settings guarantee that the Area Trigger moves as little as possible while still staying active. Lastly, make sure to change the Physics Type to "No Contact Response", since we only want to detect collision. Now return to the Object Properties menu.

The Enabled option should already be selected, but if it's not make sure to turn it on. Change the Shape of our Area Trigger to "Sphere", and set the Size to 1.90 m. Under Trigger By, we need to change some things. Since we want to detect collision with ALL objects, change the type to Exclude. Deselect Bike and Rider, as there is only one Object we need to exclude; our Game Character Sphere. Select Object Instances, and select our Game Character Sphere. Now return to the Object Properties menu.

Leave Hit Tolerance at 1, but deselect "Disable After Hit" since we want our Trigger to always be active. The rest of the options are fine as is.

2. Object Position
The second object we need is an Object Position Event to move our Area Trigger. Spawn one in from the Events section. Snap it near your other Object Position Events. Go ahead and reassign the Event/Filter for the Interval Trigger to our new Object Position Event, and assign our new Object Position Event to the Event that just lost the impulse. Make sure that no events get left out of the impulse chain.

We only need to detect collision at our feet, so our Area Trigger needs to be lower than our Game Character. To do this, we can use a similar method to raising our Game Camera. Spawn in a Two-Input Operator from the Operations sections. Change the type of Operation to Subtract, set Operand 1 to be our Game Character's Position Y, and set Operand 2 to be 0.10. This will subtract .1 units from the Y coordinate, or up and down coordinate, placing our Area Trigger below our Game Character.

Under the Object Position Event's properties, deselect Local, and turn off Modify Rotation. Assign Position X to our Game Character's Position X, assign Position Y to our new subtracted Y value, and assign Position Z to our Game Character's Position Z. Select Event Target to be our Area Trigger. Press the back button to check your progress. Make sure you can see the Area Trigger slightly protruding from the bottom of the Game Character. You can also test the track from the Start Menu. Enable "Show Editor Icons" and you should be able to see the yellow checkerboard pattern somewhere on your screen.

3. Sensitivity
I noticed while testing the track there that the sensitivity was too low, so I'll change that now. Recall from last video that the sensitivity was the value that we multiplied our Right Joy Stick by. Since they both use the same value, I'm going to combine them into a single Variable Data Source. Spawn in a Variable Data Source under the Data Sources section, and snap it near our Right Joy Stick group. To set both values at once, hold down the Multi-Select button, which is Left Bumper on Xbox, and select both Operators. When you open up their Object Properties, you should see that Operand 1 is dark. This shows that each Operator uses different a Operand 1. You'll notice that Operand 2 is still bright though, since it is the same value of 0.10. Now assign Operand 2 to be our Variable Data Source. You should see that the Variable Data Source is now connected to both Operators. Go ahead and leave the Object Properties menu. Now set your Variable Data Source to a sensitivity that you want. Since I wanted a higher sensitivity, I'll set my value to something larger, such as 0.80. Test you track to check the sensitivity. You'll notice my sensitivity is much greater now.

4. Jump State
Before we can begin jumping, we need to know when we are allowed to jump. To do this, spawn in a Variable Data Source and two Set Value Events, and snap them near your Area Trigger. For the first Set Value Event, make sure the value is 0.00 and Select Event Target to be our Variable Data Source. For the second Set Value Event, change the value to 1.00 and Select Event Target to be our Variable Data Source. Under the Area Trigger's properties, select On Hit to be our second Set Value Event. Under Advanced Events, select On Leave to be our first Set Value Event. This setup will now make the set Variable Data Source to one every time the Area Trigger is on the ground, and zero every time the Area Triggers leaves the ground. Imagine that the number one is a "Jump Available" state, and zero is a "Jump Not Available" state.

5. Jump Button
We now need a jump button. You can use any of the buttons under the Controller Buttons section. I normally use "Controller - Gas" which represents the Right Trigger and A button on the Xbox Controller. Spawn one of these buttons in and snap it near your Area Trigger group. We only want to jump when the Variable Data Source is set to one, which is the "Jump Available" state, so we need some of checker. These checkers are called Filters, under the Filters section. Spawn in the Generic Filter and snap it near your button. This Generic Filter can check numbers. Under the Generic Filter's properties, leave the Operation set to Equals, but assign Comparison Value 1 to be our Variable Data Source. Set Comparison Value 2 to be 1. This Filter will now evaluate to true each time our Variable Data Source is 1. Under your button's properties, assign either On Press or On Down to your Generic Filter. On Press will make players press the button each time they want to jump, while On Down will allow players to hold the button down and make the character jump every time it is possible. I will be using On Down.

6. Completing Logic
We also need a way to use our Jump Ability. Copy the first Set Value Event, the one that sets the Variable Data Source to 0, and place it near you Generic Filter. Under your Generic Filter's properties, Select True Event to be the new Set Value Event. This now completes the logic portion of jumping. Whenever your button is pressed, it will check to see if there is a Jump Available. If there is one, it will use that Jump by setting the Variable Data Source to 0. If there is not a jump available, it will do nothing. If you character leaves the ground without jumping, such as walking off a ledge, the Jump Ability will be used so that you cannot jump while in the air. When your character touches back down to the ground, it will replenish you Jump Ability and you'll be ready to press the Jump Button again.

7. Propulsion
Finally, we're going to apply this jumping mechanic to the Game Character through Custom Object Gravities. Spawn in a Variable Data Source and place it near your Jumping Group. This Variable Data Source will represent the Gravity of our Game Character. Change the Value of this Data Source to some negative number, which will represent the downward pull of Gravity. I'm going to use -1200. Also spawn in two Set Value Events, and an Impulse Delay Filter. The Impulse Delay Filter is located under the Filters section. Assign Event/Filters for each of these toolcards exactly as I do; order does matter. From your "Using Jump" Set Value Event, assign to the first new Set Value Event. From the first new Set Value Event assign to the Impulse Delay Filter. And finally from the Impulse Delay Filter assign to the second new Set Value Event. Make sure you can follow the chain of impulses from your button through each Event, and check that no event gets left out of the impulse chain.

Under the first new Set Value Event, change the Value to be some large positive number. This will represent the force upwards of a jump. I normally used 8000. Set the Event Target to be our Variable Data Source that represents Gravity. Under the second new Set Value Event, change the Value to be the same as your negative number in the Gravity Data Source. Again, I will use -1200. Set the Event Target to be our Gravity Data Source.

Impulse Delay Filters will hold an impulse for a desired amount of time. We want it to hold an impulse for the duration of the jump, and then send the impulse to the last Set Value Event which will return the Gravity to normal. Since a jump isn't very long, set the Delay Ticks to a small number. I normally use 6 ticks. A larger value will make you jump for longer, while a smaller value will make you jump quicker. Finally, under the Game Character's properties in the Advanced Physics section, assign the Object Gravity to be our Gravity Data Source. Your character should now be able to jump. Test your track out from the Start Menu.

FPS #3 Running
1. Gravity Fix
Before we add the running feature, we will fix a problem that was present in our last video. The character had trouble getting up steep slopes, and this was due to gravity pulling the character down. To fix this we need to modify our gravity logic. Remember that we made two separate Variable Data Sources last time; one for the Jump State and one for the Gravity of our character. Today we are going to combine those into a single Gravity Data Source.

Under the Set Value Event that changes our Jump State to zero, reassign the Event Target to be our Gravity Data Source. Press X to remove all targets, and then press A on our Gravity Data Source. Change the Value to be the same large negative number that you used to represent the downward pull of gravity. I'm going to use the same number from last tutorial, -1200. This number is going to represent the downward pull of gravity, only when our character is in the air. Under the Set Value Event that changes our Jump State to one, reassign the Event Target to be our Gravity Data Source. Again, press X to remove all targets, and then press A on our Gravity Data Source. Change the Value to be a smaller negative number, I'm going to use -200. This new number will represent the downward pull of gravity, only when our character is standing on solid ground.

Up here in our button chain, delete the Set Value Event that used our Jump State. Under this Filter, that checked our Jump State, reassign Comparison Value 1 to be our Gravity Data Source. Change Comparison Value 2 to be the same small negative number that you used for gravity while standing on solid ground. Again, I will use -200. Select True Event to be our Set Value Event that changed our gravity to be a large positive number. There should not be any connections with our Jump State anymore. This is because our Jump State has been combined with our Gravity Data Source. You can now delete the Jump State Variable Data Source. A Jump is available whenever the Gravity is the small negative number, which represents standing on Solid Ground. This is the same as checking for the Jump State to be one. You can test your track out from the Start Menu. Notice that the character has no trouble getting up slopes now.

2. Preventing Bugs
The reason our character can now easily ascend slopes is because we now have three gravity settings. In last video, we only had two gravity values. One large positive number, 8000 for me, that represented the upward force of a jump, and a large negative number, -1200 for me, that represented the downward pull of gravity. Today, we added a third number, a small negative number which represents the downward pull of gravity while on the ground. Since the number is small, gravity does not pull down as much, and thus the character can move upwards easier. The larger negative number now represents the downward pull of gravity only when the character is in the air.

Since we now have three gravity values, we also need to institute some logical checks to prevent our character from getting stuck. Copy the Generic Filter that checks our Gravity, and place it near the "On Leave" section of our Area Trigger. Reassign the Select True Event of this new Filter to be our Set Value Event that changes our gravity to be the large negative number. Under our Area Trigger in Advanced Events, reassign On Leave to be this new Generic Filter. This will now check to make sure the gravity is the small negative number before it sets the gravity to be the large negative number. This prevents our character from being pulled down while still jumping up. If the gravity is set to the large positive number, then this Filter will evaluate to False and it won't change the gravity.

We need another one of these checks to prevent getting stuck in a jump. Copy either of the Generic Filters and place it near your Jumping chain. I'm moving these Events up so that I can clearly see the impulse chain. Under the Impulse Delay Filter, reassign Select Event/Filter to be this new Generic Filter. Under the Generic Filter, change Comparison Value 2 to be the large positive number which represents the upwards pull of a jump. Again I use 8000. Reassign Select True Event to be our last Set Value Event, that changes the gravity to our large negative number. This will prevent the gravity from being set to the large negative number, even though the character is on the ground. If the character hits the ground before the jump is complete, the gravity will be set to the small negative number, and this Filter will evaluate to False, leaving the gravity as the small negative number. This is important, because our Jump State is now represented by this small negative number. You can test the track out, but nothing will have changed visibly since last time.

3. Movement Speed
In order to get our character running, we need to be able to change the speed of its movement. This can be done similar to the sensitivity of our rotation. Spawn in a Variable Data Source from the Triggers & Events, Data Sources section, and Snap it near our Left Joy Stick group. This Variable Data Source will represent the speed that we want our character to move with. Since both operators use the same multiplication value, which is fact our speed, you can assign them the value together. Select both Operators by holding down the Multi-Select Button, which is Left Bumper on Xbox. Under their properties, assign Operand 2 to this Variable Data Source. Both Operators should now be connected to the Speed Variable Data Source. Change the Data Source's value to a large positive number. I will use the same number I had before, 1200. By changing this Variable Data Source we can now change the speed of our character.

4. Run Button
Players normally start running by pressing some button. Spawn in your choice of a button from the Triggers & Events tab, and snap it near your Left Joy Stick group. I'm going to use the Left Stick Push Down button. There are multiple ways of using your button to make our character run, so I'm going to show you two possible methods. A simple button hold, and a more advanced Joy Stick check.

For a simple button hold, spawn in two Set Value Events and snap them near your button. Under the first Set Value Event, change the value to the same positive number you are currently using for speed. Again, I am using 1200. Select Event Target to be the Variable Data Source that we are using to represent speed. Under the second Set Value Event, change the value to a larger positive number which will be our character running speed. I'm going to use 2600. Select Event Tarter to be the Speed Variable Data Source. Under our button's properties, assign On Press to the Set Value Event with the larger running speed, and assign On Release to the Set Value Event with the smaller walking speed. Now test your track out from the Start Menu. Our character should speed up whenever the button is pressed, and slow down whenever the button is released.

5. Joy Stick Check
This current setup works nicely if you use a button other than the Stick Push Down button. However, many popular games use this button, and holding the Joy Stick down for long periods of time can become annoying. Therefore, many games today implement a run state, where you begin running by clicking the Left Joy Stick and then holding the Joy Stick forward. I'm going to show you how to implement this.

First spawn in a Interval Trigger from the Triggers section and a Generic Filter from the Filters sections. Under the Interval Trigger, change the Interval to one game tick, and Select Event/Filter to be the new Generic Filter. This interval trigger will now send Impulses every game tick to the Generic Filter.

Under the Generic Filter, change the Operation to Less than and assign Comparison Value 1 to our Left Joy Stick Vertical Value. Make sure the Data Source you are selecting is the Left Stick Vertical Value. Since we want to run whenever the Joy Stick is held forward, change Comparison Value 2 to the number 3. A value of 3 indicates that the Joy Stick is held all the way forward. Select True Event to be the Set Value Event that changes our speed to walking speed. Under your button, remove the On Release impulse. Select On Release, press X to remove all targets, and then simply press B to back out of the menu.

With this setup, our character will begin running whenever the button is pressed, and will continue to run until the Joy Stick is pulled back below the value of 3. At this point the Generic Filter will evaluate to true and the speed will be set to a walking speed. Test your track out from the Start Menu. Your character should now run continuously after pressing the run button, so long as you hold the Joy Stick forward.

FPS #4 Footsteps

1. Labeling
Before we add another feature to our character, it's a good idea to start labeling our toolcards. You can see that even at this stage our logic chains are getting increasingly complex. In addition, if we ever wanted to modify a piece of our character, we would need to figure out exactly what each toolcard does. Labels can help us understand and keep track of these toolcards.

For this tutorial I will be using the Extract Function as a Label. Unfortunately, this feature is unavailable in previous Trials iterations, so I recommend mapping out your toolcards on paper. Even a simple flow chart on graph paper will help. To create our Label, first spawn in any event. For Labels, I normally use the End Event as it has the least amount of options and is the least complex. Snap it above all your other toolcards. Under the Object Properties, select Extract Function. This will change the End Event into a single Function toolcard. This Function toolcard acts as a mask, hiding the Events underneath it. Deleting this Function toolcard will unhide the End Event. The useful feature of Function toolcards is that they can be renamed. Under the Object Properties, select Name and give the Function a default name. I will call mine Label. Now you can copy this Function toolcard whenever you need to label something. The amount of labeling that you do is up to you. I normally label just my Variable Data Sources, since they can represent many things.

I've just labeled our five Variable Data Sources. I've called themů "Gravity", "Sensitivity", "Pitch", "Yaw", and "Speed".

2. Movement State
To add footsteps to our character, we need to know when the sound of a footstep should be played. This kind of information is best contained in a State of Movement. Spawn in a Variable Data Source to represent this State. I'll label my Data Source "Move State". If you'll remember we implemented a Jump State for our jumping, before combining it with our Gravity Data Source. This new State will be similar, but it will encompass all of the movements of our Character. I'm going to use labels to list out all the States of our Character.

Here, I've listed out all the possible states of our character; Standing, Walking, Running, and Falling. Jumping will be included in Falling since they both take place in the air. Now spawn in a Set Value Event, and Select Event Target to be our Move State. Copy this Event and place one under each State Label. Each of our States will have a number which represents that State. Change the value under each Set Value Event to your chosen number. I will make Standing 0, Walking 1, Running 2, and Falling 3. Try to keep your numbers as positive integers, so that you can recognize them easily.

3. Determine State
In order to determine which Movement State our character is in, we will need to check some things. For this, we will be using the Generic Filter again, so spawn one in near our States. This Generic Filter is going to check whether we are standing on solid ground. To do this, change Comparison Value 1 to be our Gravity Data Source, and change Comparison Value 2 to be the small negative number you used to represent gravity on solid ground. I used -200 last video. This Generic Filter will now evaluate to True whenever the character is standing on solid ground, and False whenever we are Falling. Falling is one of our States, so Select False Event to be the Set Value Event under our Falling State.

Next we need to check whether the character is currently trying to move on solid ground. For this, spawn in two Generic Filters. These Filters are going to check our Left Joy Stick values, to see if a player is pressing the Joy Stick. Under this second Generic Filter, assign Comparison Value 1 to our Left Stick Vertical Value. Under the third Generic Filter, assign Comparison Value 1 to our Left Stick Horizontal Value. Under our original Generic Filter, Select True Event to be our second Generic Filter, and under our second Generic Filter, Select True Event to be our Third Generic Filter. Notice how the logic chain now works. If our character is on solid ground, the original Filter will evaluate to True and move to the second Filter. If the Left Stick Vertical Value is zero, meaning the player is not pushing forward or back, then the second Filter will evaluate to True and move to the third Filter. Finally if the Left Stick Horizontal Value is also zero, then our player must not be pressing the Left Joy Stick at all and our character should be Standing still. This is one of our Movement States, so Select True Event to be the Set Value Event under our Standing State.

Our final check is going to be whether our character is walking or running. Spawn in another Generic Filter, and assign Comparison Value 1 to our Speed. Change Comparison Value 2 to your Walking Speed. Mine was 1200. This Filter will now evaluate to True whenever we are walking, and False whenever we are Running. Since these are Movement States, assign them their impulses. Select True Event to be the Set Value Event under Walking, and Select False Event to be the Set Value Event under Running. Under our last two Generic Filters that checked the Left Joy Stick, Select False Event to be this final Generic Filter. If either of the Left Stick Values are not zero, meaning the Joy Stick is being pressed, then these Filters will evaluate to False and the impulse will move to our final Filter to check whether the character is running or walking.

4. Tracking State
Now that our checks are in place, we need a trigger to activate these checks. Spawn in an Interval Trigger and snap it near your Generic Filters. Change the interval to one game tick and Select Event/Filter to be the first Generic Filter that checks our Gravity. Our logic chain here is now done, but we need a way to monitor the State while playing. To do this I'm going to use a Counter. I will make a full tutorial later on how to properly use Scores and Counters, so for now just follow along. Press down on the D-Pad to bring up the radial menu and select Track Settings in the top right corner. Select Game Mode Settings. The Game Type should already be set to Skill Game if you watched the Skill Game Setup tutorial, but if not change it now. Open up the Set Scores tab, and change the Score Element to Counter 1. Change the Type to Data Source, and set Placement to Top Center. Leave everything else as is, but Select Value Target to be our Movement State. The words Counter 1 should now appear over our Movement State. Now back out of the Track Settings, and test your track from the Start Menu. Our Movement State will now be visible in the Top Center of the screen. Move around and make sure that each State has the correct number. For me, 0 is Standing, 1 is Walking, 2 is Running, and 3 is Falling.

5. Sound Loop
With our Movement State working we can now add our footstep sound loop. Spawn in another Interval Trigger and a Sound Event from the Events section. Sound Events can turn sounds on and off, as well as restart the sound. Under the Interval Trigger, change the Interval to about half a second, I normally use 32 ticks. This interval will represent the time in between footsteps. Select Event/Filter to be the Sound Event. Now spawn in a Sound Source, located under the Common Game section. There are many Sounds to choose from including a Footsteps sound in the Miscellaneous Section. Unfortunately this sound is part of the first Trials Fusion DLC, Riders of the Rustlands. For this reason I will use a different sound from the base game. A good sound that has been present ever since Trials Evolution is the Rock rumble, light sound. Change the Pitch to a number above 30 for a good footstep sound, and adjust the Volume to a desired level. Make sure to select Static so that the sound is played at a constant volume. Otherwise, the Volume will decrease as you move away from this Sound Source object. Finally under the Sound Event, Select Sound Sources to be our Sound Source object. You can test the Sound Loop out by pressing the Back Button. You should hear what sounds like footsteps. Feel free to adjust the timing of the footsteps, but remember that this should be walking speed. We will add a running speed for footsteps in a moment. Also, try combining different sounds to get a footstep sound. Just remember to select the new Sound Sources with your Sound Event when you do.

6. Using the State
We will now use our Movement State to activate our footstep sound loop. Spawn in a State Event from the Events section. State Events simply turn other toolcards on and off. When a toolcard is off it doesn't perform its designated action. This State Event is going to turn our sound loop on and off. Under its Object Properties, Select Event Target to be the Interval Trigger in our sound loop. Copy a State Event for each of our Movement States, and Select Event/Filter for the preceding Set Value Event to be each State Event. Each should form a horizontal impulse chain as so. For the Movement States that have footsteps, change the State Event to On. This would be walking and running. The other two Movement States, Standing and Falling shouldn't have footstep sounds so leave their State Events as Off so that there will be no sound. You can test your track out from the Start Menu. You should hear footsteps when running and walking, but no footsteps when standing or falling.

7. Faster Footsteps
Footsteps don't always occur at the same speed, such as when running. To change the speed, we need to change the interval between footstep sounds in the loop. Spawn in a Variable Data Source which will represent this interval. I'm going to label this Data Source too. Under the Interval Trigger, assign Interval to the Variable Data Source. Now, the interval of the footsteps can be changed with this Data Source. We will use our Movement State to change it. Spawn in a Set Value Event and Select Event Target to be the Variable Data Source. Copy a Set Value Event for each of our Movement States, and Select Event/Filter for the preceding State Event to be each new Set Value Event. The impulse chains should continue to travel in a horizontal line. For the Movement States that have footsteps, change the Value of their Set Value Events to the desired impulses for said Movement State. I will use 32 game ticks for walking, and 20 game ticks for running. The other Movement States that don't have footsteps are fine as is. Go ahead and test out the track from the Start Menu. The footstep speed should pick up when you begin running and slow done when you return to walking.

8. Stopping Quickly
One of the problems that was present in our last video was that our character wouldn't stop very quickly, even after releasing the Left Joy Stick. We can solve this using the Movement State. Spawn in a Variable Data Source. This Data Source is going to represent the Friction of our Game Character Sphere. I will label mine as such. Friction in Trials is the same as reality; the more friction, the harder it becomes to move an object. A large friction value will slow our character quickly. Spawn in a Set Value Event and Select Event Target to be this Variable Data Source. Copy the Set Value Event for each Movement State and Select Event/Filter for the preceding Set Value Event just as before. Make sure the impulses continue in their horizontal lines and that no Event gets left out of the chain. Under the Set Value Event that is in the Standing Movement line, change the Value to 1000. 1000 is the maximum Friction value for physical Objects. With this setup, our character will smoothly glide over objects while moving, but become stagnant when standing. Finally under our Game Character Sphere, in the Advanced Physics section, assign Friction to this Variable Data Source. Test our your track from the Start Menu. Your character should walk and jump smoothly, but come to an abrupt halt when you let go of the Left Joy Stick.

PneumaticBog484
07-07-2015, 03:01 AM
Reserved

PneumaticBog484
07-07-2015, 03:02 AM
Also reserved, just in case