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 4 - Making Doors Stop When They Hit The Blocker Object
The Logic behind this step is actually in reverse - The doors won't "stop" when they hit the Blocker, they just move when they are NOT hitting the blocker. I know it sounds confusing, but you will understand it soon enough...

The first thing we need to do is create the collision between the right door and the blocker object. So, insert both objects' nodes and a collision node and connect them just like the first.  You should get something like this:

Now things are starting to get serious - How are we going to make the door stop moving when it is colliding with the blocker? The answer is simple - we'll use Boolean functions! A Boolean function is one that plays with True and False values. We will configure the scene so that when the  Area-Object Collision is True and Door-Blocker is False, the door moves, and if Area-Object is True and Door-Blocker True too, the door won't move. If Area-Object collision is false, independently of the Door-Blocker, the door won't move either.

Of course, we could just add a Dynamics module into the scene and be lazy, but what would be the fun of it? It is also unfortunate that this little cheat would make our scene MUCH slower to render!

Our boolean functions should IDEALLY look like this:

Area Box Collision Blocker Collision Movement
1 (TRUE) 1 (TRUE) 0 (FALSE)
1 (TRUE) 0 (FALSE) 1 (TRUE)
0 (FALSE) 1 (TRUE) 0 (FALSE)
0 (FALSE) 0 (FALSE) 0 (FALSE)

If this were possible, movement would only occur if Input 1 is 1 and Input 2 is 0. Unfortunately such Boolean functionality does not exist. But what if we 'invert' the Blocker Collision values?  The table would then look like this:

Area Box Collision Blocker Collision Movement
1 (TRUE) 0 (FALSE) 0 (FALSE)
1 (TRUE) 1 (TRUE) 1 (TRUE)
0 (FALSE) 0 (FALSE) 0 (FALSE)
0 (FALSE) 1 (TRUE) 0 (FALSE)

As you can see, this function would only work if both collision values are true (i.e. 1). Such a function exists - It's the Boolean AND function.

But how can we make Blocker Collision's values change? There are two ways actually, but for now, we will be using another Boolean function, XOR. XOR means "Exclusive OR". To understand XOR, you need to understand OR. The OR function results a true if at least one of the inputs are true. The XOR results true if ONLY ONE of the inputs are true - If both are true then it will result false. Such a big meanie!

OR Table:

Area Box Collision Blocker Collision Movement
1 (TRUE) 1 (TRUE) 1 (TRUE)
1 (TRUE) 0 (FALSE) 1 (TRUE)
0 (FALSE) 1 (TRUE) 1 (TRUE)
0 (FALSE) 0 (FALSE) 0 (FALSE)

XOR Table:

Area Box Collision Blocker Collision Movement
1 (TRUE) 1 (TRUE) 0 (FALSE)
1 (TRUE) 0 (FALSE) 1 (TRUE)
0 (FALSE) 1 (TRUE) 1 (TRUE)
0 (FALSE) 0 (FALSE) 0 (FALSE)

If we add a Boolean XOR between the Blocker Collision and a "1" value, we will effectively invert the value.  i.e. 1 (TRUE) will become 0 (FALSE) and vice versa. The Final Result would be:

Blocker Result Area Box Result
1 (TRUE) 1 (TRUE) 1 (TRUE)
0 (FALSE) 1 (TRUE) 0 (FALSE)
1 (TRUE) 0 (FALSE) 0 (FALSE)
0 (FALSE) 0 (FALSE) 0 (FALSE)

Since the last node On value is only enabled by a True condition, the only true condition of this situation would be with the Blocker Collision off and the Area Box Collision on, which is what we need! If the Area Collision ceases, the movement will stop, and if the Blocker collision happens, the movement will also stop.

Still keeping up?  Finding this a little confusing? If case your brain is getting hot, try some C.O.F.F.E.E.! Yeah that was a nasty, evil joke. Sorry.   ;)

Now back to the tutorial. Right click the window and select New Node > XPresso > Bool > Bool. Create two Booleans, as one will be the XOR and the other will be AND. Connect the XOR first input with the Blocker Collision node output. Now connect the AND first node with the Area Box Collision, and the second with the XOR boolean output. Connect it's output with the last Right Door Node On Input. Now, you will need to create a value to XOR with the Blocker Collision. Right click and select New Node > XPresso > Calculate > Absolute. Leave it's input alone and connect the Output with the XOR Boolean's second input.

Now on the attribute window. Click on the Absolute node and set it's value to 1, as it will input to the XOR as a true value. Click the XOR Boolean and, in the Node tab, choose XOR as a function (naturally). Do the same for the AND Boolean, but selecting the AND Value (obviously). All your hard work and patience with this section should have left you with an XPresso screen like this:

We're done here (finally). The next part won't be so hard, I promise!   ;)

- 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

Blender & Yafr...
Blender & Yafr...
- Blender 3D -
SubSurf Modelling ...
SubSurf Modelling ...
- Blender 3D -
Using Calculations...
Using Calculations...
- Adobe Photoshop -
Old Movie Effect
Old Movie Effect
- Adobe Photoshop -
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, 890 views
 changes....
Author: supertackyman
Posted: Sep 12th, 2:56am
Activity: 2 replies, 1055 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, 1938 views
HTML Form Post Array to PHP
Author: Space Cowboy
Posted: May 25th, 2:18pm
Activity: 0 replies, 1834 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