Difference between revisions of "PyPRP:Ladders"
(→Creating Regions and Adding Properties) |
(→Creating Regions and Adding Properties) |
||
Line 8: | Line 8: | ||
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. These are all very important settings, and the ladder will not work without them. | 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. 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. | + | 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. |
==AlcScript== | ==AlcScript== |
Revision as of 02:19, 20 January 2008
Creating a ladder is simple but finicky.
Contents
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'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.
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. 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.
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:
- Take your number of rungs.
- Subtract six.
- 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!).
- For your bottom region:
bottomregionname (rgn_ladder01bottom for me) type: region region: type: ladder ladder: direction: up style: twofeet loops: Number of loops you previously calculated
- Make a two new lines after this, and then, for your top region, write:
topregionname (rgn_ladder01top for me) 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.