WorldViz User Forum custom avatar random walk
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

#1
02-28-2007, 04:06 AM
 krimble Member Join Date: Nov 2006 Location: Nijmegen Posts: 63
custom avatar random walk

I'm coding a scene where I have an animation of a spiderwalkcycle. It's moving up, down, left and right very well.
But that's not what I want.
What I want to do is a spider that is walking to random points. Those points have to be around a certain centerpoint because I have to be able to move that centerpoint.

I know it's a rather advanced question but I don't get it to work.
Does anyone has an idea how I have to code this?

Thank you
#2
02-28-2007, 12:16 PM
 farshizzo WorldViz Team Member Join Date: Mar 2003 Posts: 2,849
I've attached a script that generates a set of random points around a center point within a certain radius. You can use the GenerateRandomPoint(x,y,radius) function in your script. Just pass it the center point and radius and it will return a 2D point within the circle. Hope this helps.
Code:
```import viz
import math
viz.go()

a = vizmat.GetRandom(0,2*math.pi)
return math.sin(a)*r + x , math.cos(a)*r + y

viz.startlayer(viz.POINTS)
for x in range(1000):
x,y = GenerateRandomPoint(0,1.8,1)
viz.vertex(x,y,5)
viz.endlayer()```
#3
03-20-2007, 03:23 AM
 krimble Member Join Date: Nov 2006 Location: Nijmegen Posts: 63
A thanks for you reaction.

Sorry for my late reaction, I'm working on differend things know, but the spiders HAVE to work some day, so thanks for you reply.

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

All times are GMT -7. The time now is 12:55 PM.

 Contact Us - WorldViz Home - Archive - Top