Welcome, Guest

Please login or register

TUTORIALS SUBMENU

PHOTOSHOP    FLASH    ILLUSTRATOR    BLENDER    CINEMA 4D    WEB-CODING    [SUBMIT]

Related Links

Xpresso Tutorial - Mall Doors

pages (4): 1 [2] 3 4


Section 2 - Setting up the Scene
For our scene we will need:
  • A Right Door
  • A Left Door
  • A Left Door Blocker
  • A Right Door Blocker
  • A Lighting Spot to be the Switcher
  • Some objects to open the door by floating near it
  • A huge box to be your door area.

This is how I laid out my scene. Arrange it the way you want, though. It's your scene!

If you just want a bland generic scene to complete the tutorial and learn Xpresso basics without all the needless fluff, arrange it like this:

If your doors are made up of different objects like mine, group them together to one object, preferably a Null. Assign ALL objects you will want to "open" the door to a Null object too, in case you want to use multiple objects.

The Door Blockers are not seen since they are inside the walls. The Area Box must be invisible. To do this, either create a material with no color, no specular and 100% transparency and assign it to the box, or simply disable the object from being seen in the final render. Either way works, though I prefer the first (so its optionally transparent in the view port too).

The Switch is a lighting spot, which can be problematic because it emits an unwanted light in your scene.   To correct this,  go into the attributes window of the Light object, find the General tab, and mark the "No Light Radiation" box.

We are done here. Moving on....

Section 3 - Making Doors Open When Something Comes Close
The first thing we will need to do is to create an XPresso function. You can assign it to any object, but let's assign it to the Area Box for now. Right click your Area Box in the Object Manager, select New Expression and click XPresso Expression. Double click it. It will open the XPresso window, which should look a little like this:


Your clean XPresso Window!

From this point onwards, I will work with a single door, and teach you how to clone the properties to the other one later. This will make things much simpler for us in the long term.

For our first step we will need to make the door open when something gets near it. Do to this, all we need to do is define logic so that when the object (called Sphere from now on to keep things simple) collides with the invisible area box, the right door moves to the right side.

To do this, drag-and-drop the Sphere and the Area Box to the XPresso window. It will show nodes of them. Right click in the window, and select New Node > XPresso > General > Collision. This is a node that, if a collision happens between the "Inputs", will give an output of "True". If no collision happens, the Output will be "false". Simple logic really.

We will need to connect these Object nodes to the Collision Inputs. So click on the red button (which I will call the Output button, and the blue button the Input button) in the upper-right of the sphere node. An array of inputs will now be made available to you and the node that you just clicked. Select "object", and do the same for the Area Box Node. An Object output should appear with a red spot. Click and hold the left button on that red spot and move it. A line will appear, allowing you to connect with an input. Drag the line to Input 1, and a connection will appear. Do the same for the other object but with Input 2.  This sets up a simple logical configuration - i.e. when those two objects collide, the output of Collision node will be "1", or "True". If they are not colliding, it will be "0", or "False". Simple, huh?


PS: If your "colliding" object is in fact a group of many objects, check
"Include Children" in the Node tab of the Collision's attributes in the attribute window.

Now the logic gets a little more complex. We need to make it so that when they collide, the door will move to the right. Sooo.... how do we calculate this move to the right? Well, in my scene, the path the door moves is in the X Axis (check yours separately).  The door's movement, therefore, in programming terms, can be described as:

X Axis (final) = X Axis (start) + Value where value is the rate of the movement
or, more simply:
X Axis = X Axis + y

We will need to make nodes that calculate this equation. Drag and drop the Right Door into the scene. We will need to get it's X Position, then add a value (y) to give the final output. Since we will be getting it's X Position, click in the Output button and select Coordinates > Position > Position.X (or whatever axis are you using). We now need to add the Y value to it.  Right click in the XPresso window and choose New Node > XPresso > Calculate > Math. Ah-hah! We have a Math operator now! This is how it works - It will catch the value of the first input and add it to the second input. It's value will be then sent to the Output. You can leave the second input blank, as you can manually set it to a value. With this explained, click on the Math node and, in the attributes window's parameter tab, type a number in Input (2). The number you set here varies greatly with your preference and the scene scale, so I really can't help you. My advice is to start with a value of 1, and adjust it later if your doors open too slowly or quickly.  In the Node Tab you can adjust the Function but, since we are merely adding adding values, leave it as add. Now connect the Position.X of the Right Door with the Math:Add Input 1.

We want the output of this little equation to be sent directly back to the Right Door's position X (thereby allowing additive movement along the X axis), so drag-and-drop another Right Door node, and connect as Position.X input. Connect the Math's output with it. Your XPresso screen should now look a little something like this:

To summarize what we have done so far: The X-axis position of the Right Door is retrieved (node 1), added to an arbitrary value of your choice (node 2), and then assigned back to the Right Door X-axis position, changing it permanently (node 3).

We have now to connect both series of nodes, so that the door will only move to the right if the sphere is colliding with the area box.   Thankfully, there is an input called "On", which ensures that nodes are only enabled if they are receiving an input of 'true'. With this in mind,  click on the Input box of the last Right-Door Node and create the 'ON' node, then connect it to the Collision Output. You should now have something like this:

Save the Scene, and try moving the sphere inside the Area Box. If you have done everything correctly, the right door should move to the right.  If the door absolutely won't move at all, check it all again, as you must have done something very wrong. This is also the ideal time to check the movement speed of your door and tweak it a little before the coding gets too hefty.

- Tutorial written by Elentor

Pages (4): <Prev 1 [2] 3 4 Next>
Automatic Translations: Translate Into French Translate Into German Translate Into Italian Translate Into Spanish Translate Into Portuguese

Last 5 User Comments

User:  sunnyboy2005 (#19923)
Date: Sun Nov 06, 2005. 04:27:55

Post #1 of 1

Very nice, clever Xpresso tutorial.

Reply to this post


--- View Entire Thread ---
Amazing Font Pack!

Featured Tutorialsmore

HyperNURBs Modelling
HyperNURBs Modelling
- Maxon Cinema 4D -
Stray Energy
Stray Energy
- Adobe Photoshop -
Micro Buttons
Micro Buttons
- Adobe Photoshop -
Blender & Yafr...
Blender & Yafr...
- Blender 3D -
Membership

Username:
Password:  
Remember Me

Lost Password? || Register

Related Links



Special Options
Printer Friendly Version
Forum Threads

 Deactivate Account
Author: jerinian
Posted: Oct 02nd, 11:16am
Activity: 1 replies, 889 views
 changes....
Author: supertackyman
Posted: Sep 12th, 2:56am
Activity: 2 replies, 1053 views
Back again and with free webhosting :)
Author: ngz
Posted: Aug 14th, 3:50pm
Activity: 0 replies, 1055 views
Cartoon Crab 6 Legs Walk Run created in Blender
Author: patricia3d
Posted: Jun 19th, 12:58pm
Activity: 0 replies, 1937 views
HTML Form Post Array to PHP
Author: Space Cowboy
Posted: May 25th, 2:18pm
Activity: 0 replies, 1833 views
My blog where i create Digi Scrapbook
Author: claudya07
Posted: May 11th, 2:33pm
Activity: 0 replies, 14444 views
Blood Dripping from Letters
Author: patricia3d
Posted: Apr 05th, 3:37am
Activity: 0 replies, 2757 views
A New Designer has joined the ranks
Author: skates1
Posted: Mar 28th, 2:19pm
Activity: 2 replies, 2777 views
The hole in Photoshop
Author: Mars
Posted: Feb 13th, 9:28pm
Activity: 2 replies, 3441 views
Colour Swatch
Author: ebz7350
Posted: Jan 15th, 11:18am
Activity: 0 replies, 2357 views
 BioRUST Forums - Reply to Topic
Author: inonShozy
Posted: Jan 11th, 11:32am
Activity: 8 replies, 2500 views
 Version 2 of my portfolio site.
Author: andrewnleon
Posted: Jan 08th, 6:18am
Activity: 6 replies, 2800 views
Forum Threads

--- Site Resources ---
Total Tutorials:212
Total Downloads:    441
Total Fonts:    4673