Random walk python

Hi all,

Can anyone make a script in which a cube moves to random locations, with brakes in between. And can’t get out of a certain region. :stuck_out_tongue:

If not, how can I make a random choose between serveral cases. For example:

Choose case 1/4

If case 1:
Print case 1

etc.

Thanks :wink:

If you are talking about a simple region like a circle or square than you can do that simple. If you are talking about a more complex region like a irregularly shaped concave region that you might require some pathfinding.

However both are fairly easy to generate that random spot, in the case of a square or circle its easy to get there, a concave shape is harder to get there.

I await your reply.

Well if you’re looking for something simple -> example is attached.

PS: I did it “the blender way”, rather than going the least brick route, which is what I usually do.

Attachments

random_walk.blend (136 KB)

Thanks a lot Social. =] It looks great. But is there also a way to do it without an empty?

@Andrew
A rigion or square rigion is perfect for me. :stuck_out_tongue:

Yes -> example is attached.

I only used the “empty-trackto” combo because I wanted to show the “blender way” of doing things.

This is simpler, though.

Attachments

random_walk_no_empty.blend (135 KB)

Thanks super much man. =] Helped a lot.