|
![](/i/fill.gif) |
So.. What do I mean by that? Well, I have a little bot I made that,
currently, is fairly stupid about how it flies around. It occurred to me
that I could improve it using a spline path, but then I also considered
that this has a limitation, since I am using a "through the points"
version, which doesn't allow you to "fine tune" the curve.
So, instead I am looking at this, an interpolated B-Spline:
n = llGetListLength(P);
// Create B, A and D list of same length as P here.
B[1] = -0.25;
A[1] = (P[2] - P[0] - D[0]) / 4;
for (i = 2; i < n - 1; i++){
B[i] = -1 / (4 + B[i - 1]);
A[i] = P[i + 1] - P[i - 1] - A[i - 1]) * B[i];}
for (i = N - 2; i > 0; i--){
D[i] = A[i] + D[i + 1] * B[i];}
// Figure out our ends, so things start and end where they are
// supposed to.
D[0] = (P[1] - P[0])/3;
D[n] = (P[n] - P[n - 1])/3;
So.. This has more elements, so *may* allow someone to play more with
the results, and produce a curve that gets "sloppy".
I just have two problems... The first one is that the A part has to be
pre-computed for the path, so you can't "recompute" the thing on the
fly. Catmull-rom had the advantage that, you could change the next point
"on the fly", since it only computed between three points, and the
computations didn't require, as above, that you first compute where your
control points needed to be *then* computer the path *from* those. I.e.,
P is where you would like to be, A is the B-spline control points, and D
is the actual path. Means, if I use this, I have to recompute any
changes I make, as the bot moves between the computed points, which
wastes more script time.
Now, Catmull I could tweak the curve, to some extent, by either adding a
multiplier, i.e., adjusting the curve slightly over/under its normal
size, but that just grows/shrinks the path, without changing the path.
Picking some other random point, and using that for the next target, in
the path, is also something vaguely possible, but I don't want this
thing wandering through a wall, because the curve segment plotted sends
it through one, and unless I pick "middle of the room" for every path
point, I can't be sure that any point I pick won't be outside the room.
Basically, when this thing takes damage, I want it to start pathing
erratically. Instead of following nice smooth paths between rooms, I
want it to go a bit off-path, worse as it gets more and more damaged.
And, while I would have preferred Catmull, due to the much simpler, and
stepwise friendly, math it uses (the interpolated one is *not even
close* in that regard), I figured maybe mucking with B in the above
might produce the effect I wanted.
Any suggestions?
Mind, I can detect walls, by running into them, so, it just occurred to
me that I could pick a random point within some value of the third one
in the current path, then just "bump" the wall, and recompute with the
next "correct" point, or the like. Need to experiment with that a bit..
Still.. Would be nice to have a clear idea what I am going to end up
with first. I am not even sure, since the system doesn't have any
indirect (I.e., not running into them first) way of finding walls yet,
how to work out where such a bot should be "allowed" to fly, never mind
mess with the path after. Closest I can manage now is to prefigure where
all the points are it needs to know about, then compute "between" those
preset points. Which is just annoying, since I have to then do that (or
if I sell a version, provide someone else with a way to do so), for
every single place I might want to put the thing in. It also presents
problems for another design I wanted to do, which I might want to have
coded to "Look for tight places, corners, the edge of walls, and keep
away from people, but still close enough to see them." That's going to
have to wait for them to implement the ray cast test, which will allow
mapping of a space, though.
--
void main () {
if version = "Vista" {
call slow_by_half();
call DRM_everything();
}
call functional_code();
}
else
call crash_windows();
}
<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
3D Content, and 3D Software at DAZ3D!</A>
Post a reply to this message
|
![](/i/fill.gif) |