Making Subworlds (Elevators and Rides)

From OpenUru
Jump to: navigation, search

EDIT 9/22/2010: This tutorial has been edited to reflect the changes that Drizzle 28 and later allow. The previous version that showed how to do this will still work, however, this updated version shows the proper way to make the Exit Regions for SubWorlds.


Subworlds are how we "move" the avatar around. Whenever you use an elevator, ride a train, jump to a spinning building's bridge, etc. If the avatar is to ride objects in Plasma, we use Subworlds to make this happen.

Uru:CC/POTS, UU, and Alcugs used Havok for it's physics. MOUL:a uses PhysX. However, the way you make Subworlds in Max is very much like how they are made with Blender and the GoW Plugin.


Getting Started.....

First you are going to need a few things built in your Age. You'll need Enter and Exit regions, A Dummy, an object that is going to move your Avatar. As you can see I have these things in my picture below:

newSW1.jpg

The red arrow points to my Exit region. The blue arrow points to my Enter region. You can also see the empty hollow box that is the SubWorld Dummy.

Now in Max with Cyan's Plugin, you will NOT be animating your objects such as the Elevator Platform. Instead, you will be animating your Subworld Dummy you put in. So it is important to position you objects where they need to be at the beginning of the animation.

In the previous version of this tutorial, I had you position your Exit region at the bottom, so that it would animate with the subworld. This is no longer the case. You can place your subworld region where you want it to be. I'll show you how to keep it from moving like everything else that is linked to the subworld dummy a bit later in this tutorial.

Once you have your objects made, and have assigned the PageInfo component to all of them, select your Dummy. Change it's name to something useful, like SubWorld Dummy or Elevator Subworld, etc.

It is important to note that you do NOT change the name of the dummy after you have assigned the "SubWorld" component to it! Doing so will cause a "Access Violation" error when you go to link into your Age. Make sure you name your subworld dummy BEFORE you assign the SubWorld component to it!

Open up the Component manager and click on New>Physics>Subworld and assign it to the Dummy:

SubWrldMax1a.jpg

You can rename the component to something other that "Subworld01" if you want and I would recommend you do so if you are going to have more than one Subworld. What we just did was designate the Subworld coordinate system with this object.

Now select your Enter Region you made. Assign it a Region Sensor component and set it up like this:

SubWrldMax3.jpg


You want it to trigger when you enter, but also this gives the region it's physics.

Now with the region still selected, call up the Component Manager and click on New>Physics>Subworld Region

SubWrldMax2b.jpg

And assign this component to the Enter Region. Then go over to your Component Utils and select it:

SubWrldMax4.jpg

When you do, where it says "Join Subworld Region" your button will say "none". Click on it, and then click on your Subworld Dummy in your 3D Scene window. The button will now say the name of your Dummy you made. Make sure you have a dot where it says "Enter" as we want to join the subworld when we entered the region.

Now go up and select your Exit Region. Take note of how I have my subworld Exit region positioned.

newSW2.jpg

As you can see, it's halfway on and off of the platform we are going to walk on to after the elevator ride. Notice also that I have a collider plane (the aquamarine plane) that extends out from it. This plane is NOT linked to subworld, but will make sure that when the player does exit subworld, they do not fall halfway through the floor! Sort of like a safety net.

Now with your Exit Region selected, open up your Component Manager. Click on New > Physics > Subworld Region and assign this new one to the Exit region (meaning you should have 2 SubWorld Regions now, one on your Enter Region, and now one on your Exit Region).

Go to your Utils tab, and select that SubWorld Region you just assigned to your Exit Region:

newSW5.jpg

In this case, you want to leave the button that says "None" ALONE! Do not touch it! Leave it saying "None"! I'm also going to leave the trigger for it to "Enter". You could set it to "Exit" and what that will do is have the player leave SubWorld when they EXIT this region, but I want the player to exit SubWorld right when they ENTER this region. The reason why will become clear a bit further on in this tutorial.

Now we need to link the objects that the avatar will be interacting with while in the Subworld. Colliders, for the elevator platform and the Bounds for our Exit Region would ignore our avatar unless we link to them to the Subworld.

To do this, go up to the menu bar in Max, and enable the Linking Tool (where I've circled in red in the pic below):

SubWrldMax9.jpg

Using this tool, Click and Hold on each object that you need to link to your Subworld Dummy. Like in the pic below, I Click, Drag, and Drop from the Elevator Platform to the Subworld Dummy (you can see the dotted line in the pic below as I did this):

SubWrldMax10.jpg

Again, you'll need to do this with each object that the avatar needs to collide with, and with the Exit Region.

Now that you've linked everything, we you are going to be almost ready to animate your subworld. BUT, in our case here, we DO NOT WANT the Exit Region to move up and down with the subworld dummy. To keep this from happening, select your Exit Region. Open up your Component Manager, and click on New > Misc. > Filter Inherit. And assign this component to the Exit Region:

newSW3.jpg

Then go to the Utils Tab and select the Filter Inherit component, and look at the roll out box for it. As you can see, we are going to use this to tell the Exit Region that while it is linked to SubWorld, we don't want it to move with the subworld when it animates. In this case, the subworld is going to go just up and down (Z Axis), so we put a check mark there:

newSW4.jpg

Once you have done all this, you can now animate the Subworld Dummy. As you move the dummy about (move it's position, rotation, etc), you will see all the objects that you linked with it move too. But you'll notice that your Exit Region stays in place where you need it! It's important to remember that you attach the animation component to the Subworld Dummy, NOT your objects. If you try to apply them to your objects, you will get an error when you try to export, as you can not have a Physics Component assigned to an object that is animated.

Side Note: There will be times when you may want your Exit Region to move with your subworld. Let's say you have a ride that you let the player control. If they can stop the ride in the middle of the animation, you can allow them to get off of it there. But if you don't move the Exit Region with the ride in that case, the player will not be able to exit subworld. So again, while this tutorial is showing you to NOT move the exit region, there may be times when you do want it to move with the player.

That's it, that is all there is to it. There are more and complex ways to go about this, but this gives you the basics of it.

EDIT: Make sure you have Drizzle 28 as your Drizzle version! Drizzle 27 and earlier will NOT convert your Subworld components correctly!


Using Responders To Enter and Exit SubWorld

In the previous version of this tutorial, I had you create a responder to exit the player from SubWorld. You can also use a responder to place the player IN SubWorld. All without having to mess with regions! Nice and simple, eh?

Yep...and you pay for that simplicity. Using a responder to have a player enter and exit subworld is a BAD IDEA if your Age is going to have multiple players in it! Here is what happens:

20 people are in my Age Neolbah. 19 of them are off exploring, reading journals, etc. One of them however decides to use the elevator. When they walk on and push the button, the responder will "place local player in subworld" What happens is the one player goes for an elevator ride, while the other 19 players suddenly fall through the floor! Not good! "Local Player" is seen as "Everyone that is in this Age". Same thing is true for using a responder to exit subworld. Let's say I had 2 elevators. When player 1 is done with his elevator ride, the responder will "remove local player from subworld" now for anyone else, this is okay, they won't fall through the floor. And for the first elevator rider, he or she will be fine. But if the 2nd player that is riding a DIFFERENT elevator which is in a DIFFERENT subworld is still riding that elevator when the responder "removes local player from subworld", they will be removed from the subworld THEY are in! So they'll be falling down through their elevator platform!

So as you can see, while using a responder to have a player enter and exit subworlds is the easy way of doing things, it can REALLY mess up your players if your Age is on a Shard!

There are times that you can use this without fear of messing anyone up. If your Age is not going to be on a shard, but used only by people using the stand alone version of Uru, then there won't be a problem. However, you'll find that while you put your Age out to the public to have fun with, many shard owners will download your Age and put it on their shard, with or without your consent! Then they'll complain that your Age is not working right! Hows that for irony? heheheh. However, let's say you have an Age that is not "sharable", like the Cleft or the Bahro caves. In those cases, where only 1 player can be in it at one time, you could use the responder way of Entering and Exiting SubWorld just fine.


Using Colliders With Your Elevator.....

Setting up colliders with your elevator can be a pain. You want the player to be able to enter the elevator, but not fall off of it while it's moving. Here's an example of how you can do it (and there many ways to do this, this is just one example).

Okay, I want a simple collider around the elevator platform to keep the player from running or falling off while the elevator is moving. So I put a box that is going to be my invisible collider around the platform:

newSW7.jpg

But I can't leave the faces on the box like this. I have to flip the faces, else the collider will not work correctly. So with the box selected, go to your Modifier tab, and make it an Editable Mesh. Then select all the faces or Polys, and in the roll out box, click on the button to flip all the normals:

newSW8.jpg

Now your box should look inside out:

newSW89.jpg

Now assign Proxy Terrain for the physics so that it has collision but is not rendered, and link it to your subworld dummy.

Now if you have it, your Enter and Exit regions in the right place, this is what will happen:

By having the normals flipped and the Enter region just inside the collider, your player will not feel the collision walking on to the platform, but will now be in subworld and will now collide with the inside of it! When the platform reaches it's destination, you can see how I have the Exit region set up with it:

newSW1-.jpg

It's partly inside the Exit region. This is WHY we set the trigger for the Exit Region to "Enter" when the player starts to enter the Exit region, they will be removed from subworld, and now they will no longer collide with the collider. They will walk right out and on to the platform.

I'd like to thank Boblishman and Dustin for the help that they gave me on this. Bob for coming to me with different ways to use subworlds that got me to investigate them more, which lead to realizing that the way this tutorial used to read was not correct. And Dustin for his patients with us when I would say: "uhhhh....Drizzle isn't working right.......", and making the additions to Drizzle so that it would convert all of this correctly. Dustin has the patients of Job and is great to work with!



Return To: 3DS Max Plugin Tutorials

Copyright (C) 2011 Andy Legate.
heckert_gnu_62x60.png
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU Free Documentation License".