[edited]
[Club Owner] revbob [645] : While we're waiting, y'all
might want to click on "Links" and go to the link on top
[Block Leader] cym [2830] : cool
[Block Leader] cym [2830] : you wrote a new lesson :-))
[Block Deputy] Satchmo [270] : oki
[Club Owner] revbob [645] : Sure, I was tired of the old
one -- and decided I probably wan't ever going to get it right ;-)
[Club Owner] revbob [645] : You might want to click on
the link marked [1] -- there's some fairly large images there
[Club Owner] revbob [645] : And it may take a while to
download them
[Club Owner] revbob [645] : If the images look weird,
go back and click on [1a]
[Block Deputy] Satchmo [270] : can you put the whole tutorial
in a zip file for me to dl.
[Club Owner] revbob [645] : Go to links, Satchmo, click
on the first one, and at the bottom of the page, you'll see exactly that
[Club Owner] revbob [645] : And i'll post the chat log
there (sometime)
[Club Owner] revbob [645] : Whaddaya say, shall we get
started?
[City Architect] MrPhillip [2408] : sure
[Club Owner] Xopher [245] : sure ready when you are
[Club Owner] revbob [645] : OK, there's two ways to
make your avatar walk/flap/slither/etc. when you walk
[Club Owner] revbob [645] : The easy way is with Spazz3D.
[Club Owner] revbob [645] : Keith and I and a couple of
others (cym?) started to analyze a walking stick figure av somebody was wearing,
[Club Owner] revbob [645] : And as a result, Keith put
the code into the latest version of Spazz3D
[Club Owner] revbob [645] : So click on [1] in your other
window, and let's look at what you have to do to do it the easy way
[Club Owner] revbob [645] : The first parameter is the
period for the motion
[Club Owner] revbob [645] : I have the flamingo's walking
set to 2 seconds, which seemed pretty realistic
[Club Owner] revbob [645] : If you make that value smaller,
people with slow machines won't see it
[Club Owner] revbob [645] : If you make it larger, you'll
keep walking after your avatar stops
[Club Owner] revbob [645] : So use your judgment there
[Club Owner] revbob [645] : Note that loop is unchecked,
and you check "I'll start it myself"
[Club Owner] revbob [645] : The huge image shows something
you're probably familiar with if you use Spazz3D
[Club Owner] revbob [645] : You have to edit the animation.
Everybody with me, or have we all fallen asleep?
[Club Owner] revbob [645] : Btw, y'all might want to make
that second window smaller in Y so you can still see the chat text
[Club Owner] revbob [645] : Anyhow, I think the rest of
the stuff on the page is pretty self explanatory
[Club Owner] revbob [645] : But then I would, wouldn't
I
[Club Owner] revbob [645] : Does it seem reasonable?
[Club Owner] Xopher [245] : yes
[Club Owner] revbob [645] : OK, click back and let's look
at the hard way
[Block Leader] cym [2830] : yes :-)
[Club Owner] revbob [645] : Whoops -- got ahead of myself.
Go ahead and click [2]
[Block Leader] cym [2830] : okay
[Club Owner] revbob [645] : This is the standard Blaxxun
avatar arena, but I've added a couple of things
[Club Owner] revbob [645] : The red bar on the left controls
your turn in the yaw axis (I'll be back to this later)
[Club Owner] revbob [645] : And the red square on the
right controls walking
[Club Owner] revbob [645] : Click and drag on both of
them
[Club Owner] revbob [645] : If you drag on the one to
the right, it should walk
[Block Leader] cym [2830] : it does
[Block Leader] cym [2830] : cool
[Club Owner] revbob [645] : OK, let's look under the hood,
shall we?
[Block Leader] cym [2830] : sure
[Club Owner] revbob [645] : Btw, I've got the files for
the new avatar linked on that page
[Club Owner] revbob [645] : So click Back and click [3]
[Club Owner] revbob [645] : The text in red and green
in the PROTO declaration are the fields of the "extended avatar" PROTO
[Club Owner] revbob [645] : The ones in red type are the
only ones we'll be talking about today
[Club Owner] revbob [645] : We need to get somebody here
to tell us what the others do
[Block Leader] cym [2830] : ok
[Club Owner] revbob [645] : Notice that Spazz3D generates
the Switch node -- and, in fact, everything in that file except for a couple of comments
[Club Owner] revbob [645] : That lets the world switch
out your av, which is kind of cool
[Club Owner] revbob [645] : Presumably it's an LOD kind
of thing, but I'm just guessing
[Club Owner] revbob [645] : Anyhow, the rotation goes
right into the topmost Transform
[Club Owner] revbob [645] : And here's another guess --
but I can't imagine that they'd do it any other way -- I think it's from a big ProxSensor
[City Architect] MrPhillip [2408] : I think they use that
switch at www.blaxxun.com for avatar lod
[Club Owner] revbob [645] : OK, if you haven't already
scrolled down in the file, click Back and then [4}
[Club Owner] revbob [645] : That's to save you a little
scrolling, that's all -- same file
[Club Owner] revbob [645] : OK, like I said, all this
file is generated by Spazz3D
[Club Owner] revbob [645] : The green stuff is the interesting
stuff, and the red stuff makes one point I want to make
[City Architect] MrPhillip [2408] : ok
[Club Owner] revbob [645] : The way Keith's code works
is that it lags the avatar position by a second
[Club Owner] revbob [645] : It pumps the translation through
an interpolator
[Club Owner] revbob [645] : And then off to the topmost
Transform
[Club Owner] revbob [645] : So. That's enough looking
under the hood for this one.
[Club Owner] revbob [645] : Like I said, you don't have
to do anything to make an av walk the easy way except what's on [1]
[Club Owner] revbob [645] : So let's have a look at the
new avatar arena, because there's some really cool stuff there
[City Architect] MrPhillip [2408] : k
[Club Owner] revbob [645] : Click Back and click [5]
[Club Owner] revbob [645] : And look at all those cool
PROTO fields!
[Club Owner] revbob [645] : Some of them are implemented
now and some are set up for future versions of CoCi
[Block Leader] cym [2830] : cool
[Club Owner] revbob [645] : These are stolen from a file
Peter Graf sent me
[Club Owner] revbob [645] : And I've commented out everything
I don't use
[Club Owner] revbob [645] : You can uncomment them and
see what happens
[Club Owner] revbob [645] : Cosmo Player (anally) complains
about fields in the PROTO instance that aren't in the PROTO
[Club Owner] revbob [645] : So you'll need to put those
fields into your file if you're viewing it with Cosmo Player
[Club Owner] revbob [645] : That is, your main world file
[Club Owner] revbob [645] : That's about all I want to
say about it -- right mouse on [6a] and [6b] and grab the files for yourself if you want them
[City Architect] MrPhillip [2408] : thanks
[Club Owner] revbob [645] : OK, questions so far?
[City Architect] MrPhillip [2408] : Keith has these improvements
also?
[Club Owner] revbob [645] : The extra PROTO fields? No
-- that's why they're commented out here
[Club Owner] revbob [645] : So now let's look at doing
it the hard way
[Club Owner] revbob [645] : First of all, why do it the
hard way?
[Club Owner] revbob [645] : Well, gulls don't walk
[Club Owner] revbob [645] : And they bank when they turn
(ahem)
[LATER: I was wearing my gull av, and I demonstrated how the gull banks when it turns]
[Block Leader] cym [2830] : :)
[Club Owner] revbob [645] : So let's look at the requirements
and the design
[Club Owner] revbob [645] : I always get those two confused
(requirements and design)
[Club Owner] revbob [645] : So click [7], and let me explain
the way airplane people talk
[Club Owner] revbob [645] : Click through the viewpoints
and you'll see the three axes
[Club Owner] revbob [645] : The way we want to turn the
gull when it banks is through the roll axis
[Club Owner] revbob [645] : But the way the gull moves
in the world is in the yaw axis
[Club Owner] revbob [645] : Phi and psi if you're entirely
too educated
[Club Owner] revbob [645] : And so, we see that the roll
we create ought to have something to do with the yaw angle we get from the world
[Club Owner] revbob [645] : And if you think ahead just
a trifle, you'll realize that we'll need to have two transforms
[Club Owner] revbob [645] : That is, the yaw will drive
the outer one and the roll will drive the inner one
[Club Owner] revbob [645] : We'll come back to that. There
is an alternative -- you could add the rotations through a matrix, but that's too hard
[Club Owner] revbob [645] : Then you'd only need one transform
[Club Owner] revbob [645] : So go back and click [8]
[Block Deputy] pemby11 [260] : when is this lesson over Bob?
[City Architect] MrPhillip [2408] : When you have learned
it all.
[Club Owner] revbob [645] : Pretty soon
[Block Deputy] pemby11 [260] : lol
[Club Owner] revbob [645] : lol#mrp
[Club Owner] revbob [645] : @
[Block Deputy] pemby11 [260] : never!!!!!
[Block Deputy] pemby11 [260] : in other words
[Club Owner] revbob [645] : OK, what I wanted to show
in 8 was that roll is about Z and yaw is about Y
[Club Owner] revbob [645] : OK, clic on [9]
[Club Owner] revbob [645] : click
[Club Owner] revbob [645] : Since we've been talking about
roll, let's stay with it
[Club Owner] revbob [645] : That's the second function
[Club Owner] revbob [645] : The only hard part is getting
the algorithm right
[Club Owner] revbob [645] : The amount you roll should
depend on the RATE of change in yaw
[Club Owner] revbob [645] : In other words -- you too
can sound like an aero guy -- phi = psi_dot
[LATER: like an ignorant aero guy -- actually, phibody = f(psi_dotearth). I needed to specify the coordinate systems, which are different. Of course, in a real airplane, psi_dotearth = f(phibody and some other stuff), but in CoCi, dragging the mouse already makes us turn in the earth coordinate system, so we're just simulating a bank (phi in body axes) that's sort of proportional to the turn rate (psi_dot in earth axes). The difference in coordinate systems is another reason you need to apply the roll to a different Transform, preferably an inner one. Oh, yeah, "_dot" means first derivative in Newton's notation. Just think of it as "change in" if you don't remember your freshman calculus any better than I do.]
[Club Owner] revbob [645] : Now why do we bother to
compute and then divide by delta time?
[Club Owner] revbob [645] : Because the change in yaw
between this time's value and last time's depends on how fast your browser is running
[LATER: Let me try to clarify that comment a little: you hit the Script and look at your angle. Then, some time later, you hit the Script again and look at your angle. You use the difference in angle to compute your roll. But how much time elapses between the two times you hit your Script? It depends on how fast your browser is running. Slow browsers (or slow machines) will take a long time doing other things like rendering the scene, displaying the chat, and so on. Fast browsers will execute all the other stuff they have to execute much faster, so they'll hit the Script the second time much sooner than the slow browser does, and so they'll see a smaller difference in angle between this time and last time. That's no good. You don't want your gull to bank a different amount for every person.]
[Club Owner] revbob [645] : So people with slow browsers
will see a huge change in angle and people with fast ones will see a little bitty change in angle
[Club Owner] revbob [645] : So you divide by delta time
to even that out for everybody
[Club Owner] revbob [645] : So everybody sees the bird
bank the same amount
[City Architect] MrPhillip [2408] : humm, interesting.
[LATER: It turned out that multiplying the result of the division by 1 looked pretty good, but that isn't always the case. This is where you put in your fudge factor]
[Club Owner] revbob [645] : Yup, flight simulation
101 -- learned it at my mother's knee
[Club Owner] revbob [645] : Now notice the trick I tried
(and it worked) to compute yaw
[Club Owner] revbob [645] : It turns out by pure blind
luck that in CoCi, if you multiply the axis by the angle, it doesn't swap signs when it passes through zero
[LATER: if you're walking upright]
[Club Owner] revbob [645] : So your gull doesn't do
a weird flip
[Club Owner] revbob [645] : Good going for the folks at
CoCi
[Club Owner] revbob [645] : This should work if you're
walking up and down a hill that isn't too steep or tilted sideways at a small angle
[LATER: The sentence above replaces one that was unclear and probably wrong]
[Club Owner] revbob [645] : so have we wrung every
last drop of boredom out of the roll script?
[City Architect] MrPhillip [2408] : not bored, but continue
[Block Leader] cym [2830] : eh
[Block Leader] cym [2830] : yes, go on :-)
[Club Owner] revbob [645] : Ok. there's way too many variables
in that Script, but I wanted to make it as clear as I could
[Colony Deputy] Mindlord [2715] : It might be useful to give
some examples of elsewhere this tech could be used.
[LATER: I missed this excellent comment. Anybody know some other examples?]
[City Architect] MrPhillip [2408] : Oh,, then we look
at it.
[Club Owner] revbob [645] : Ditto for the flap script
[Club Owner] revbob [645] : Too many variables
[City Architect] MrPhillip [2408] : Bob works for Boing,
they make planes
[City Architect] MrPhillip [2408] : ooops boeing
[Club Owner] revbob [645] : OK, the distance between two
points in 3D is what, class?
[Club Owner] revbob [645] : Better than Bong
[Block Leader] cym [2830] : :)
[City Architect] MrPhillip [2408] : straight line
[Club Owner] revbob [645] : sqrt (x**2 + y**2 + z**2)
[Block Leader] cym [2830] : the distance between two points
in 3d?
[Block Leader] cym [2830] : Oh, okay
[Colony Deputy] Mindlord [2715] : that's it. :)
[City Architect] MrPhillip [2408] : y=mx+b
[Club Owner] revbob [645] : Where x is x[1] - x[2]
[City Architect] MrPhillip [2408] : yes I was going to say
that next
[Club Owner] revbob [645] : And so on
[Club Owner] revbob [645] : Since we're just going to
compare that value to a constant, there's no point in doing the square root
[Club Owner] revbob [645] : So the tricky logic in the
IF block says, "if it's changed since the last time I looked, start flapping"
[Club Owner] revbob [645] : But if it hasn't, don't update
the last time's value -- that's to prevent the gull from sneaking up on you
[Club Owner] Xopher [245] : Sorry I missed a bit while I
was out, going back a bit, I take it delta__ is the change in __ variable
[Club Owner] revbob [645] : Yup
[Club Owner] revbob [645] : I could have divided by delta
time here, too, but all I wanted to do was say "if it's moved SOME, flap"
[Block Deputy] pemby11 [260] : have you implemented this
to your Gull?
[Club Owner] revbob [645] : Yup.
[City Architect] MrPhillip [2408] : read [1] to [9] pemby
and you will see this,
[Club Owner] revbob [645] : Anyhow, some short, meaty
script functions
[Club Owner] revbob [645] : Full of tricks that flight
simulator guys like me use every day
[Club Owner] revbob [645] : But people who haven't been
initiated into the black art of simulation don't always know
[City Architect] MrPhillip [2408] : I understand
[Club Owner] revbob [645] : So anyhow, go back and click
on [10], and the red slider to the left should make it bank
[Club Owner] revbob [645] : You'll also see a problem!
[Colony Deputy] Mindlord [2715] : Looks like I need to dig
out my old engineering and physics books again...
[Club Owner] revbob [645] : Oh yeah -- and when you do,
maybe you solve the problem on 10
[Club Owner] revbob [645] : you cn
[Club Owner] revbob [645] : you can CAN CAN
[City Architect] MrPhillip [2408] : unstable at high angles?
[Club Owner] revbob [645] : Notice that the PlaneSensor
makes it jittery
[Club Owner] revbob [645] : I think it's because the mouse
backtracks some
[Club Owner] revbob [645] : on the PlaneSensor
[City Architect] MrPhillip [2408] : Oh, I see.
[Club Owner] revbob [645] : At any rate, the jitter varies
directly with coffee consumed
[Club Owner] Xopher [245] : LOL
[City Architect] MrPhillip [2408] : Oh, that is to be expected.
[Club Owner] revbob [645] : Now in real life, driving
it from the world's ProxSensor, that doesn't happen
[Club Owner] revbob [645] : But it does in the arena
[City Architect] MrPhillip [2408] : Oh, and that is how you
started out this lecture. The World's prox sensor.
[Club Owner] revbob [645] : And putting it through a first
order lag, like the code Spazz3D generates, doesn't fix it
[Club Owner] revbob [645] : It turns out that lag doesn't
cope well with changes in direction
[Club Owner] Xopher [245] : Have you put rotational limit
on your roll animation?
[LATER: I missed that question -- the answer is no -- I probably should]
[Club Owner] revbob [645] : But at this point, since
the problem only comes up in the arena, I decided to hell with it
[Club Owner] revbob [645] : Don't fix working code
[Club Owner] revbob [645] : One last tricky bit you should
notice
[Club Owner] revbob [645] : Keith and I stumbled on this
when we first looked at the walking avatar
[Club Owner] revbob [645] : If you want your feet to come
back together when you stop walking, you can either
[Club Owner] revbob [645] : (a) write some fiercely difficult
code to make that happen
[Club Owner] revbob [645] : or (b) simply set loop TRUE
when you want to move and FALSE when you want to stop on the time sensor that drives the walking
[Club Owner] revbob [645] : Want to guess which one we
chose?
[City Architect] MrPhillip [2408] : Oh, B
[Club Owner] revbob [645] : You bet. We wer both lazy
[City Architect] MrPhillip [2408] : raises hand and says....
B!
[Club Owner] Xopher [245] : Sloth ... the mother of invention
[City Architect] MrPhillip [2408] : If mankind was not lazy
we would have not invented the wheel
[Club Owner] revbob [645] : I meditated about whether
I'd have to drive the startTime on that sensor from the Script
[City Architect] MrPhillip [2408] : I thought that was Frank
Zappa.
[Club Owner] Xopher [245] : LOL
[Club Owner] revbob [645] : And at the end I couldn't
tell the difference, so I took it out
[Club Owner] revbob [645] : If you can tell the difference,
put it in
[Club Owner] revbob [645] : That is, you may start in
mid-step if you don't drive the startTime
[Club Owner] revbob [645] : So just take a look, and if
you have to, just pass the timestamp from the flap script to the sensor
[City Architect] MrPhillip [2408] : well, mine has some funky
walking things
[Club Owner] revbob [645] : Yeah. I think Keith's way
is better for walking
[Club Owner] revbob [645] : But if you just want to, say,
make your head spin around while you're moving
[Club Owner] revbob [645] : The simpler script should
do it fine
[City Architect] MrPhillip [2408] : Well, she stops and starts
on the same step.
[City Architect] MrPhillip [2408] : That may be me (the way
I did it)
[City Architect] MrPhillip [2408] : but it gives her a gimp
[Club Owner] revbob [645] : Ah, the joys of animation
-- where is time zero?
[Club Owner] revbob [645] : It matters
[City Architect] MrPhillip [2408] : time zero is standing
there.
[City Architect] MrPhillip [2408] : time 5 is standing there
[City Architect] MrPhillip [2408] : 2= left step, 3=right,
4=left.
[City Architect] MrPhillip [2408] : I probably could put
in only two steps and be better off
[Club Owner] revbob [645] : I wouldn't. I think if you
change it you're going to have a whole mess of code to handle starting and stopping
[Club Owner] revbob [645] : have = have to write
[Club Owner] revbob [645] : Whew -- we made it to the
end, more or less
[Club Owner] revbob [645] : Questions -- and I remind
you, it's no trouble at all for me to say "I don't know"
[Club Owner] revbob [645] : ;-)
[Club Owner] Xopher [245] : Thanks bob, now it is time to
play with what I've learned :-)
[Club Owner] revbob [645] : Great, come grab me if there's
something I screwed up the explanation of
[Club Owner] revbob [645] : Or the code
[City Architect] MrPhillip [2408] : I guess I will also reduce
my time cycle so she is not in slow motion
[Club Owner] revbob [645] : Yeah
[Club Owner] revbob [645] : People with slow browsers
will see it jumpy almost no matter what you do
[City Architect] MrPhillip [2408] : still, when folks see
a waling avatar they are impressed
[Club Owner] revbob [645] : Oh yeah, especially if it
moves as nicely as yours does
[Club Owner] revbob [645] : Don't look too close at that
walking flamingo -- that was about 10 minutes' effort
[Club Owner] revbob [645] : Hey, Phillip, do you happen
to know if CoCi does dead reckoning on positions and angles?
[City Architect] MrPhillip [2408] : I do not know
[City Architect] MrPhillip [2408] : frown
[Club Owner] revbob [645] : I'm guessing not, since when
things get slow, I sometimes see people jump from one place to another
[City Architect] MrPhillip [2408] : do not tell anyone!
[City Architect] MrPhillip [2408] : I am making a "Complex
avatar Tutorial" web page.
[Club Owner] revbob [645] : Great!
[City Architect] MrPhillip [2408] : Spazz groups in groups
in groups and why
[Block Leader] cym [2830] : cool :)
[Club Owner] revbob [645] : You're welcome to swipe any
of the images from my tutorial page if it will save you time
[City Architect] MrPhillip [2408] : Thanks, but I see doing
a couple of screen dumps and some text.
[Club Owner] revbob [645] : Yup
[City Architect] MrPhillip [2408] : and a .spz file
[City Architect] MrPhillip [2408] : with it all setup
[Club Owner] revbob [645] : Good idea!
[Club Owner] revbob [645] : Don't forget to include the
colors you're going to use in that file -- a real time saver
[Club Owner] revbob [645] : i.e., save it after you've
picked the colors
[City Architect] MrPhillip [2408] : ok
[City Architect] MrPhillip [2408] : OK, thanks...gott go
I guess.
[Club Owner] revbob [645] : Cya
[Block Leader] cym [2830] : C U MrPhillip