Register

thpsX

still here.

News:

We out here.
Upload Approved
****

Xgthug Offline

November 25, 2018, 08:06:52 PM
Newbie Posts: 3 Karma: 0
Hey guys, I thought I'd expand on Sattan's documentation by sharing this foolproof technique I came up with in Blender to create classic handrails, as well as some other tips I picked up from the helpful folks in the THPSX Discord channel.

This tutorial is going to assume that you already have Blender, the Thug Tools plugin, and have a decent grasp on the material covered in Sattan's basic level creation tutorial.
If you haven't, I recommend you start here:
http://thpsx.com/forums/index.php?topic=694.0

Moving along, let's get right into this rail creation technique that I'm eager to share with you.

PART 1 - Shaping the Rail

1) Go to object mode and create a basic cube.


2) Go to edit (tab) and vertex mode. Hit A and make sure all 8 points of the cube.  Hit ALT+M and enter to merge all points at the center point.  The point of this is to create one single vertex/dot.


3) Assuming you are working with just one vertex now, make sure it's selected and hit E to 'extrude'. Move your new point around, using the keys X and Y to lock along the axis as needed to keep your rail straight if desired, then hit ENTER when your new rail point is where you want it.  Assuming you can get the hang of this and navigate and whatnot, this is going to be how you shape and dictate the path of your rail.


4) Now we're going to make the support posts of the rail.  Assuming you're fluent in selecting points and extruding, select all the points of the rail where you want the vertical supports at, press E to extrude, and Z to lock to the vertical axis so that you can drag all the points down into to floor level.
(NOTE: This must be done one vertex at a time. If you try to extrude multiple points at a time, Blender will go bonkers and not perform the desired task.)


5) Your rail path should look something like this when you're done. 
Now in Object mode, in the right menu, click the little wrench button to open the Modifiers menu.  We're going to add a Modifier that will turn this into a proper rail.


6) Select the SKIN modifier. 


7) Boom, now it's starting to look like a proper rail.
But you might notice it's a little too thick for your liking.  To change the thickness of your rail, go to edit mode, line/edge mode, and hit A to select all your lines.  Hit CTRL+A and drag your mouse a bit to change the thickness of your rail.  (This may take some getting used to, but if you can't figure it out just google some tutorials on using the Skin Modifier in Blender.)


8) Now that we've got the rail looking how we want it, and assuming you are happy with the path of your rail (because it might be difficult to change after this step), go back to Object Mode and the Modifier menu and click "APPLY".  This is going to apply the modifier and make your rail a proper mesh.


9) This next step is crucial so don't overlook it.  You may have noticed that our rail has a surplus of unnecessary polygons, which is bad news for performance.  But don't worry, we'll fix that in the next step. 


10) Select your rail in object mode and go back to the modifier menu.  We're adding the Decimator modifier to cleanly, efficiently, and instantly lower our poly count.


11) Select PLANAR mode in the modifier menu.  It will instantly do what you want it to do. 
Then hit APPLY.


12) We're now done with the actual shape of the rail itself.  Throw a UV texture on there, then in Object mode, select your rail and navigate to the THUG Tools menu on the left of your window. 
Make sure that "Export to Scene" is checked but that "Export to Collisions" is unchecked.
I'll explain why in the next section.


PART 2 - Adding collision to the rail
As you know from Sattan's tutorial, the THUG2 engine is finicky about collisions, so we're going to generate a new object for our rail collision in just a few simple steps.

1) This first step is the most important so follow closely.  Select your current rail object, go to edit mode (TAB), and then go to Face Selection mode.  Select all of the flat TOP faces of your rail only.
Hit SHIFT-D (to duplicate) and immediately hit ENTER to lock the location, and without deselecting, hit P and ENTER to create a new object.


2) Go to Object mode (TAB) and select your new rail-top object that you just created.  Be careful not to select the rail itself.
Go to Editing mode (TAB) and face selection and hit A to select all the faces, which should be one continuous line of faces along the rail's top only. 
Hit E to extrude and Z to lock to the vertical axis.  Just drag 'em straight into the ground, assuming it's not getting in the way of anything beneath.  You should now have a solid collision box along your rail. 


3) To make sure that the collision box is invisible in game and that the rail itself is seen in all of its glory, select your new rail top object and go to your THUG Tools menu.  You are going to do the reverse of what you did earlier. 
MAKE SURE that Export to Collisions is CHECKED and Export to Scene is UNCHECKED.


4) Assuming you paid attention to Sattan's tutorial and have 'Backface Culling' enabled, and understand that only outer faces register collision in THUG, you may need to select your collision box's faces, click MESH>Normals>Flip Normals.
Make a mental note to come back to this step if you find yourself getting stuck inside your rail or the collision doesn't work as expected.


PART 3 - Rail Nodes
Your rail is basically done at this point, but if you've tested your map you may have noticed that you can't actually grind it.  There are two ways to make a rail grindable, the first is by using mark rail, which you should have already learned if you're reading this tutorial, and the second is using nodes.  We're using nodes because they give us more options and versatility in the long run.

1) Select your rail object.  Go to edit mode and select ONE continuous outer line.  Imagine this line as the part of the rail that the player can actually grind on, so naturally you don't want corners. 
In the THUG Tools menu, click EXTRACT RAIL.  This is going to make a rail node out of your selected edge. 


2) You should now have this dorky looking tube.  It's your rail node.  Make sure it's selected in Object mode.


3) We now have to align the rail node to your rail.  This part can be tedious if you don't know what you're doing.  Hit G to start moving, and X, Y, or Z to lock the axis and hit enter when you're done.
Because the 'Extract Rail' tool creates fat rail nodes, you're going to want to position your rail node so that the actual rail in the CENTER of the fat tube.  It should look like this.


4) Test out your map and adjust as needed, then you're done with your rail. 

Perfection.


PART 4 - Making your rail taggable in Graffiti

1) Select your rail object.  In the THUG Tools menu, check "Is a TrickObject".  This tells the game that you can mark this object in graffiti.  Because our Rail Node is a separate object from the rail itself, and because the rail itself has no collision or grind-ability of its own, it is VERY IMPORTANT that you fill in the cluster with a value that will link the two objects.  I chose hall_rail, all lowercase.

2) Repeat the same exact step for your rail node.  Both the rail object and the rail node object should have these same exact values applied.  That's it.  Your rail now works in graffiti. 


PART 5 - Rail Boosts
This step is entirely optional
Rail boosts are only used sparingly in situations where the player cannot get enough velocity to clear a rail, or you want them to grind upwards while defying gravity. 
Be careful with these because they can make or break a rail.

1) Select your rail node. In object mode, go to your THUG Tools menu. Click "TRIGGER SCRIPT" and "CUSTOM".


2) Now click Create TriggerScript


3) To edit the script, you will need to go to script editing mode. Do that by clicking this dropdown at the top of your Blender window.


4) At the bottom of your script editing window, make sure you select the right script: The one you just created.


5) Now that you have your corresponding rail script selected, paste the following code into your script editor:

Code: [Select]
    :i $RailAccelerate$:s{
    :i $rate$ = %f(0.100000)
    :i :s}



(NOTE: You can change the speed of the boost by modifying the $rate$ variable.
0.100000 should be enough for most cases, but if you know what you're doing you can modify this value.)

That's it.  Hope it helps. :)
« Last Edit: November 25, 2018, 08:34:15 PM by Xgthug »


thpsX Home Park Uploads Skater Uploads