HELP! - containing random motion

Hi all, if anyone could help me with this I’d greatly appreciate it. I’m experimenting with random brownian motion and it works great. Code below:

    goto=Math.random()*Math.PI*2
x=x+r*Math.cos(goto);
y=y+r*Math.sin(goto);
this.lineTo(x,y);

so what this gives me is a great random little scribbler that I love. What I can’t get it to do is to follow an “approximate path” while moving randomly. I.e. moving randomly within a confined space. I don’t want to use the traditional bouding box idea b/c the shape I’d like to confine it to is more complex. What I need is more of a path solution, or a bounding box that is a complex shape. Any ideas anyone?

Best regards,
zf.

Just guessing… :wink: , but wouldn’t that have something to do with the Math.max() and Math.min() functions?

Hi Kalliban, thanks for the reply. Well, yes and no. That was my first crack at it too, but that doesn’t get me past the traditional rectangular bounding box ideaology. I need it to follow a more complex shape. The more I think about it the more I think that the only way to do it is with a normal frame based mc and a root actionscript controlling it.

I got this link from voets yesterday:
http://proto.layer51.com/d.aspx?f=919

I don’t know if this will help you, but I think you should give it a try.