WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #15  
Old 12-02-2013, 07:57 AM
Frank Verberne Frank Verberne is offline
Member
 
Join Date: Mar 2008
Location: Netherlands
Posts: 148
I think you can just apply a vizproximity sensor with a circlearea of 5 (meters) to one (moving) avatar, and add a vizproximity target to the other (moving) avatar. When the avatars are within 5 meters from each other, the sensor (avatar1) should sense the target (avatar), and then you can respond to that event.

See the example below
Code:
import viz
import vizact
import vizshape
import vizproximity

viz.go()

sphere = vizshape.addSphere(radius=1)
sphere.setPosition(0,0,20)
sphere.color(viz.GREEN)

box = viz.add('box.wrl')
box.color(viz.ORANGE)

def moveObjects():
  boxPos = box.getPosition()
  boxPos[2] += .1
  box.setPosition(boxPos)
  spherePos = sphere.getPosition()
  spherePos[2] += .01
  sphere.setPosition(spherePos)

vizact.ontimer(.1, moveObjects)

manager = vizproximity.Manager()

target = vizproximity.Target(sphere)
manager.addTarget(target)
sensor = vizproximity.Sensor( vizproximity.CircleArea(5),source=box)
manager.addSensor(sensor)

def EnterProximity(e):
  print 'enter'

def ExitProximity(e):
  print 'exit'

manager.onEnter(sensor,EnterProximity)
manager.onExit(sensor,ExitProximity)
Reply With Quote
 


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 Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
input from a text file dig Vizard 5 10-20-2013 01:20 AM
Lighting relevant text? knightgba Vizard 1 01-26-2011 05:33 PM
Informationboxes with text snoopy78 Vizard 3 07-16-2009 10:23 AM
Vizard tech tip: Text to Speech Jeff Vizard 1 01-15-2009 09:39 PM
3d Text with Transparent Borders vjosh Vizard 3 12-01-2004 10:50 AM


All times are GMT -7. The time now is 05:42 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC