Hi there people! Here I am again, this time with a walkthrough of one of the
coolest Cinema 4D functions ever: XPresso! What is XPresso, you ask?
Well, it's a visual programming tool that enables you to make cool scripts for your
animations. Unlike competing solutions (such as COFFEE), it is also completely visual and
removes the need for overly explicit coding. So, with that explained, lets
get started!
Section 1 - Introduction
This tutorial is very advanced, and, unlike the
Meteor tutorial, expects that you are already competent with the modelling
and interface basics of Cinema 4D. Just in case you don't know what XPresso looks like,
then you can check for the final result of our tutorial below:
Looks complicated, huh? Well, to be perfectly honest, is *IS* complicated, and
takes some considerable time to master. Many people say that learning
Xpresso is easy. Well, just to put the record straight I will repeat
myself - It's NOT that easy! In
fact, I sometimes think that using Xpresso is even more complicated than programming,
although I cannot confirm this statement with absolute certainty, because the biggest program I ever made was a baskara equation and
matrixes calculator. Whilst we are on the subject of
programming experience, I am happy to report that you will not need any prior
knowledge at all to start using Xpresso, although experience with logical
process creation would be handy. Once you get past the basics, though, things get
a lot easier, and if you have difficulties at the beginning you shouldn't worry
- after all, its natural when starting in a new language, especially
if you never programmed before.
So then, what are we going to create in this tutorial? Well, the idea is to make a little script to
open a set double
doors (just like those pesky automatic doors in shopping centers) when an object
gets close to them, and then have them close automatically after it moves away. Just to
summarize, here's a little movie clip to show you what I mean:
When something gets close to the door, it opens.
When there's nothing near the door, it closes. Simple!
Note: The movie to the right is in a QuickTime format and
should load automatically (plus install the relevant applet). If
you can't see the movie, you may need to enable JAVA for your browser or
lower its internal security settings.
The above clip is easily explained in the following terms:
There is an "area" around the door. When an object enters it, the right door
will move constantly to the right, whilst the left door moves to the left.
After these doors reach a certain point, they stop.
After the object leaves the area, they will go back to their former position.
This explanation needs to be embellished with a little programming logic.
How is this done? Well, after deciding the
objective of the script, you will need to re-write your plan using clearer
logic. Thus, the complete logical sequence in programming/xpresso terms is
as follows:
There is an area (a box) around the door. If an object collides with this box,
the right door will move constantly to the right, whilst the left door will move to the
left.
There is an object hidden in the scene, whose purpose is to block the door
movement. If they are colliding, the door will stop moving. Also, if they are
colliding, switch 1 will be set. For a switch I will use a hidden lighting spot
brightness value.
If Switch 1 is set and the there is no object inside the area, the doors will
close.
After the doors collide, switch 1 turns off.
Now it starts to get 'exciting'...
and by 'exciting' I mean 'headache-inducing'. Because
this is a tutorial and not a show-off, please keep in mind that I will introduce some
logical pathways and
connections in a way that could be done much simpler. The sole purpose of this
method is not to confuse you, but to teach you some new nodes and different methods of logic. So
then, what
will you need before starting this tutorial?
A full knowledge of the Cinema 4D Interface.
Basic modelling skills.
And what will you learn?
Assigning an XPresso Function to an object.
Making Switches with XPresso.
Boolean functions.
Nodes you will learn: - Object node. - Collision. - Math.
- Bool (Boolean). - Absolute.
Sounds cool doesn't it? Well, lets get right onto the
action then!