PyPRP:Ladders

Disambig gray.png

This is a tutorial page.Versions available: PyPRP; 3ds Max; Korman.
 

Creating a ladder is simple but finicky.

Creating the Basic Shape

Let's start with the first rung. Get your rung shape worked out, then scale it correctly (use a 6-unit cube as a height reference) and position it 0.42 units off the ground (use "Global" coordinates in the Transform Properties for best results). Duplicate it with SHIFT-D, moving it up 1 unit. You can also create individual rungs, but this will take more time of course. Create as many rungs as you want! But be sure to keep track of how many you have.

Creating Regions and Adding Properties

Add two Generic Logic Regions via the Scripts > Add > PyPRP button. Position one region's object center on the floor's exact height, and name it something ending in "bottom". I'll use rgn_ladder01bottom. Move the other region up the number of rungs up in units from the height of the of the bottom region (for example, if your bottom region was at 0 units on the Z axis, and you had a 14 rung ladder, you would move the top region to 14 units on the Z axis), and name it something ending in "top". I'll name mine rgn_ladder01top. Now, move your top region 4 units to the right on the Y axis. This allows your avatar to line up perfectly with the surface that it is to land on.


Skip over this paragraph if you do not have any problems with any object(s) object center

You'll know what the object centre is, when in object mode, you'll see sometimes another pink dot in the middle of the object, this is the "object center", often you can by mistake move the object in edit mode, and then later on find its centre is somewhere different, to bring that "object center" back to the centre of the object again, just be sure you are in object mode, and on the menu of the 3D window select Object -> Transform -> ObData to Center and then just move your object while in object mode back to where you want it.


Your regions should already have the "String" property named "type" with the value of "region". Add another "String" property named "regiontype" with a value of "climbing" to both of them, and set their Bounds on and Static TriangleMesh.

string type region
string regiontype climbing

These are all very important settings, and the ladder will not work without them.

Lastly, you will need to turn your bottom region 180 degrees on the Y axis, so that it is facing AWAY from the ladder. Without this, the avatar will not mount the ladder from the correct direction.

Note: You may need to make sure that the Z coordinates for both the bottom and top regions are the same in both Object mode and Edit mode. If they are different, you can have some strange results, such as your avatar appearing to start climbing halfway up or down. To check this, select the region while in Object mode and hit the N - key. Look at the properties box, specifically the area that says: "LocZ: xx.xxx" (xx.xxx being your coordinates). If the numbers there do not match your calculated coordinates for the region, change them by double clicking in this box, and typing in the correct coordinates. When you do, the region will move. Immediately go to Edit mode. Look at the properties box again. Look at Median Z:xx.xxx (again, the xx.xxx are your coordinate numbers). Double click on this box and again type in your calculated coordinates. The region will move back to where it is suppose to be. Change between Object mode and Edit mode. The numbers mentioned above should now match, and now your avatar will correctly mount the ladder, in the right place.

AlcScript

Much like ladders themselves, AlcScript is finicky. Be sure to indent correctly!

Calculating Loops

"Loops" are the number of times that the avatar moves both of its hands. To calculate loops:

  1. Take your number of rungs.
  2. Subtract six.
  3. Divide by two.

For example, for my 14 rung-ladder, I would have 4 loops. Write this number down or otherwise remember it, because you will be using it soon!

Adding AlcScript

If you haven't already, use Scripts > Add > PyPRP > Set Default AlcScript to generate an "AlcScript" text file. Open a text editor window in Blender and browse to the AlcScript file. Write the following (bold values are ones that will be different for each different ladder!).

(Note: Pay particular attention to the colons (:) and the single space between them and the next word! (where applicable) e.g. direction:[]up)

  • For your bottom region:
rgn_ladder01bottom:  ##Change "rgn_ladder01bottom" to your own ladder-bottom-region name
	type: region
	region:
		type: ladder
		ladder:
			direction: up
			style: twofeet
			loops: Number of loops you previously calculated
  • Make two new lines after this, and then, for your top region, write:
rgn_ladder01top:  ##Change "rgn_ladder01top" to your own ladder-top-region name
	type: region
	region:
		type: ladder
		ladder:
			direction: down
			style: twofeet
			loops: Number of loops you previously calculated

Conclusion

Your Age should be ladder-riffic by now. Adding a footstep region around the ladder works for adding sounds to it, and the ground that you want your avatar to land on at the top should be .1 units higher on Z than the center of the top region.

If you have any problems, feel free to contact us in our forums.

Creating an Auto-Ladder

NOTE: This is a separate method for creating a ladder. It does not require two regions or any alcscript.

As an alternative to manually setting up the ladder regions, you can also use the "climbable" region, which you place around your ladder with it's approximate size and shape, and PyPRP will create the top and bottom regions for you during the export.

First, run Scripts > Add > PyPRP > Add a (Generic) Logic Region

Change the logic properties to:

string type region
string regiontype climbable

Then, rotate the region so that it's Local Y axis is pointing away from the climbable surface of the ladder. (as shown in the picture below) then, in edit mode, scale it to encompass your ladder. The Y surface should be flat with the climbable surface of the ladder. The bottom of the region should be exactly at floor level, and the top of the region should be an exact even number of blender units above the bottom. (32, in this case) The top of the first rung of the ladder should be 0.42 units above ground level, as stated in the previous section.

Climbable.jpg