#1
|
|||
|
|||
Walking avatars --> collision detection?
Currently I am working on a scene in which I as viewer am surrounded by a lot of walking people (the default avatars).
However, the walkto-command sometimes lets an avatar walk through 'myself', resulting in a jump of the viewpoint (due to the collision detection). In what way is it possible to solve this problem (proposed it is possible!)? I can mess a little with the coordinates I send the character to, but as I can walk freely through the scene, this cannot be guaranteed. Another problem is avatars walking through each other. Don't they have any collission detection? And to ask my last question: is it possible to group avatar objects into an array? Take a look at my code below and you'll understand why . See an example piece of code below: PHP Code:
|
#2
|
|||
|
|||
Hi,
There is no built-in way to prevent avatars colliding with each other or having them collide with the viewpoint. You will have to perform this collision check manually. You could create a timer that checks if two avatars are a certain distance from each other and stop them if they are. You could do the same with the viewpoint too. Here is some code to use arrays to create your avatars: Code:
#Create the avatars avatars = [] for x in range(9): a = viz.add('female.cfg') a.translate(1,0,1) avatars.append(a) #Have all the avatars walk for a in avatars: a.act(a.walkto(view_pos[0] + whrandom.randint(-2, 3), 0, view_pos[2] + whrandom.randint(-2, 3))) |
#3
|
|||
|
|||
A thought on this problem came to mind --
Since avatars do not detect collision with each other, how about giving them something to collide with? It would seem to me that it could be possible to have each avatar (and the viewpoint) surrounded with invisible rectangular prisms (or octagonal for a more "round" fit) that follow them wherever they go. If avatar A gets to close to avatar B, then avatar A will be stopped by the prism surrounding avatar B. |
#4
|
|||
|
|||
This is called 'the bounding volume' method in collision dection.
Quote:
|
|
|