Making Rides

There comes a time when you want to have a ride to take the player from one place to another, and you'd want that ride to be a little more complex than just a platform moving backwards and forwards.

The purpose of this tutorial isn't how to use Subworlds, as that subject has already been covered, no the purpose of this tutorial is how to use a Wizard (that had once been written by Grogyan with help from FunkyWyrm on Blender Artists and Lontahv here at the Guild of Writers, but now a totally revamped too) to allow for more interesting animations or rides through the use of subworlds relatively easy.


The Wizard

This wizard is a complement to our own PyPrp, and should allow the user to create curvy animations or rides relatively easy as opposed to key framing.

 Path2IPO.zip

Just extract to your Blender Scripts directory the same as you would do with PyPRP

Blender directory\.blender\scripts

Create a curve

Before you can use this wizard you need to do some things, first of all you need a curve, any curve will work, it can be either a Bezier or NURBS, or even cyclic versions or each. So either using the Add menu on the top tool bar or press the space bar in the 3D window select Add -> Curve -> Bezier Curve or Add -> Curve -> Bezier Circle for cyclic curves ie curves that go round in "circles" or Add -> Curve -> NURBS Curve or Add -> Curve -> NURBS Circle for cyclic curves

Switch to edit mode and select a control point (preferably the last in the chain), and whilst holding down the Ctrl key left click your mouse and place curve segments.

Write down or enter in the "Transform Properties" in the 3D window (press "N") the name of this curve EXACTLY, case sensitive.


Making it a 3D curve

Great you have a curve, so now what, are you wanting it in 3D space or not, well assuming you want it to be a curve in 3D, you need to switch back to Object mode, so press the "Tab" key. Now in another window, make it a buttons menu. Switch to the editing buttons or press the "F9" key

You should now see a whole bunch of buttons and settings relating to curves called in the "Curve and surface" pane.

Looking in this pane you should see a button called "3D" by selecting this you'll be able to manipulate the curve in all 3 dimensions


Making it a path

One of the most important steps is to make sure its a path, so in the "Curve and Surface" pane, click the button "CurvePath" and FollowCurve" and whether the curve is already in 3d mode or not you should see in the 3D window a whole bunch of little arrows, these point in the direct of the curve, currently the wizard will only handle a single direction of curve.


Attaching an Object to the path

I recommend you use an Empty for this, as an Empty won't be rendered in game, but can easily be seen inside Blender to alter your Path before executing the script.

Same as adding a Curve, press "Space Bar" in the 3D window and select Add -> Empty

Next you need to clear the "Empty" of all Location, Rotation and Scale values, so in the Transform Properties" mini window open, for each of the Loc values click the mouse button on the number and type "0" (the number not the letter). Same for the Rot values, make them all zero too. For each of the Scale values type "1".

Assuming you still have your "Transform Properties" mini window open, to the right of the Object name you can see the letters "par", this means Parent, and is one of the ways you can use Blender to parent one object to another.

So type in this box the name of the Curve that I told you to remember, and press "Return".


And then, all going well the Empty will snap to the Curve, and not out to once side with a dotted line (that means that some Loc values have not been cleared)


Giving it a name

Now I have done some of the work for you here, so all you need to do is give the Empty a name, give it something meaningful. You can do this this way, in the 3D window open up the "Transform Properties" mini window, you can also press the "N" key while the mouse cursor is in the 3D window. Where it says "OB:" enter a name to the Empty.


Animation length

Next is the step where you tell the wizard how long or smooth the animation will be, so still in the "Curve and Surface" pane look for a box that says "PathLen" and change the value here for how long the animation will be in game, (recommended you stay in a length divisible by 30 and leaving no remainder), if the animation cuts out too soon then you'll need to do the following.

Switch to the Scene buttons or press "F10", select the "Anim" tab in the "Anim Bake" pane and then change the "End" value (in frames) to something higher. This is a global setting so it will directly affect all animations in your Age if this number is too small.


Generate the interpolation 2D curves

Ready to generate your interpolation curves? Make one window a "Ipo Curve Editor" window or split an existing one. Go back to the 3D window and select the Empty in "Object Mode" Switch one window temporarily to a "Scripts" window,or split an existing one. and from the menu select Scripts -> Wizards -> Path2IPO If you want you can look in the Blender console to see a printout off all the frames generated.


Assign an animation to an object

After execution of the script several things happen,

The first is that the currently selected object in the 3D window should say in the bottom left corner "Zero_Surplurflous_Obj", this Empty is redundant, and because of limitations with Blender's API, this Object cannot be deleted in code, so you'll have to delete it manually, so just press the "Delete" key and press the "Return" key.

The second thing that happens is that your original Empty has had it parenting removed, ready for any subsequent objects that may or may not have seperate animations tied to them.

The third thing is that this "Empty" of yours already has the generated Ipo's already assigned to it, so there isn't much else you can do, except for maybe one last thing.

I recommend you toggle the button for the "Empty" to make it "X-ray". This will help identifying where the "zero plane" exists in relation to what ever you may want to do next.


Adding other objects to the animation

Adding Alc script

This I'm going to leave blank because there are too many ways that this can be done.

But if you do want to use it for rides, then I suggest reading SubWorlds


Complex ride

He he, now for the the fun stuff. If you havn't done so already you can preview the animation in the "3D Window" by pressing Alt+A, and press "Esc" when you have had enough.

You can model anything you want for the ride, but it must be at the "world origin", that is where all 3 axes meet, you can also make animations for any mesh seperate and triggerable by regions and AlcScript and Python, which I am not going to go into here.

Just remember that with everything modelled around the world origin, you need to give them each a constraint, so in the "Buttons" window, select the "Objects" button or press "F8". On the far right hand side here you'll see a pane called "Constraints", add one for each mesh. Each will be a constraint "ChildOf". Enter in the "OB:" box the name of the Empty and press "Enter". This will snap the object to the location relative to Empty. Also in the "Buttons" window under "Logic" or by pressing "F4" make each one an "Actor" and "Dynamic".

Now when you export your Age with PyPRP your ride will be waiting for you.


Last thoughts

It is recommended that if you are using the curve as a ride for the avatar to ride on, that you create it in the Current Scene, and just add the following to every object that is to be part of the ride

 "Logic Properties" 
 string     Name: page_num     Value: any value above 0 

And set your ride up as a Subworld. This is how Cyan does it, and is good practice to follow their lead.