View Single Post
  #1  
Old 09-12-2005, 05:01 AM
sjroorda sjroorda is offline
Member
 
Join Date: Apr 2005
Posts: 13
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:
import viz
import whrandom

# Handles all timer events for the therapist machine
def mytimer(num) :
    if (
num == 1) :
        
view_pos view.get(viz.HEAD_POS);
        
a1.act(a1.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));
        
a2.act(a2.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));
        
a3.act(a3.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));
        
a4.act(a4.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));
        
a5.act(a5.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));
        
a6.act(a6.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));
        
a7.act(a7.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));
        
a8.act(a8.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));
        
a9.act(a9.walkto(view_pos[0] + whrandom.randint(-23), 0view_pos[2] + whrandom.randint(-23)));

viz.go(0);
view viz.get(viz.MAIN_VIEWPOINT);

# Create the room and make it a bit larger
myroom viz.add('../room/room.wrl');
myroom.scale(10310);

# Set background color
viz.clearcolor(000);

# Turn on collision detection
viz.collision(viz.ON);
viz.stepsize(0);

# Test moving avatars
a1 viz.add('female.cfg'); a1.translate(101);
a2 viz.add('female.cfg'); a2.translate(101);
a3 viz.add('female.cfg'); a3.translate(101);
a4 viz.add('female.cfg'); a4.translate(101);
a5 viz.add('female.cfg'); a5.translate(101);
a6 viz.add('male.cfg');   a6.translate(101);
a7 viz.add('male.cfg');   a7.translate(101);
a8 viz.add('male.cfg');   a8.translate(101);
a9 viz.add('male.cfg');   a9.translate(101);

viz.callback(viz.TIMER_EVENTmytimer);
viz.starttimer(11viz.FOREVER); 
Reply With Quote