![]() |
|
|
|
#1
|
|||
|
|||
|
Hi Maya,
You forgot to make text_2D invisible in the beginning. Code:
text_2D = viz.addText('radiation source area', viz.SCREEN )
text_2D.setPosition(0,0,20)
text_2D.color(viz.RED)
text_2D.visible(viz.OFF)
|
|
#2
|
|||
|
|||
|
hi Frank,
thanx for ur replay. I made the text invisible. but now, the text does not appear at all. am I doing something wrong? one more thing. in my case I have 1 server and 2 clients, I want the text to appear when either one of the clients (or both) reaches the radiation source. where do u recommend me to add the code for the proximity? (in client1 and client2 or in server side)? |
|
#3
|
|||
|
|||
|
I have tested it with the code below. With that code, the text appears when you enter the small red sphere.
Code:
import viz
import vizshape
import vizproximity
viz.go()
viz.MainView.setPosition([0,0.1,0])
#Enable full screen anti-aliasing (FSAA) to smooth edges
viz.setMultiSample(4)
#Increase the Field of View
viz.MainWindow.fov(60)
piazza = viz.add('piazza.osgb')
sphere = vizshape.addSphere(radius=0.2)
sphere.setPosition(0,0,20)
sphere.color(viz.RED)
text = viz.addText('radiation source',parent=sphere)
text.setPosition([-0.3,0.3,0])
text.setScale([0.2]*3)
text.color(viz.RED)
text.visible(viz.ON)
text_2D = viz.addText('radiation source area', viz.SCREEN )
text_2D.setPosition(0,0,20)
text_2D.color(viz.RED)
text_2D.visible(viz.OFF)
#Create proximity manager
manager = vizproximity.Manager()
#Add main viewpoint as proximity target
target = vizproximity.Target(viz.MainView)
manager.addTarget(target)
sensor = vizproximity.Sensor( vizproximity.CircleArea(0.1),source=sphere)
manager.addSensor(sensor)
#Change state of avatar to talking when the user gets near
def EnterProximity(e):
text_2D.visible(viz.ON)
print 'enter'
#Change state of avatar to idle when the user moves away
def ExitProximity(e):
text_2D.visible(viz.OFF)
print 'exit'
manager.onEnter(sensor,EnterProximity)
manager.onExit(sensor,ExitProximity)
Either way, the code for making the text appear should be on every party that needs to see the text. For instance, if the text has to appear on both clients, then both clients need the code for making the text visible and invisible. It seems like the condition to show the text on any machine is that one of the two clients enter the radiation zone. So in that case, you should at least communicate the state of each client to each other, and make the text appear when either one of them enters the radiation zone. You could also let each client communicate to the server whether they are in the radiation zone or not, and if one of the clients enters the radiation zone, you could let the server send a message to both clients. In both cases, you need a proximity sensor in client1 and client2, and somehow communicate the states of those clients to each other (either directly, or through the server). Please elaborate more on your specific problem if these suggestions do not point you in the desired direction. |
|
#4
|
|||
|
|||
|
uh ok it's working. but, I wanted the text to appear when the avatar is for example 1 meter far from the radiation source. this is supposed to be a dangerous area and the message is there to warn the avatar that this is an affected area with radiation. so, he is not supposed to get close from it.
I am using only 1 PC, it is the server and the 2 clients at the same time. there is a communication between server and clients: 1. server can communicate with client 1 2.server can communicate with client 2, but client 2 can't read its messages 3. client1 can communicate with client 2, but client 2 does not c the messages 4. client 1 communicate with 2, but again client2 can't c the messages client 2 can't c messages sent by server and client 1. mmm.. I think I will just add the text code in both clients and i want them to communicate with each other. thanx |
|
#5
|
|||
|
|||
|
Quote:
Code:
sensor = vizproximity.Sensor( vizproximity.CircleArea(0.1),source=sphere) Code:
sensor = vizproximity.Sensor( vizproximity.CircleArea(1),source=sphere) |
|
#6
|
|||
|
|||
|
Thanx a lot. It worked.
|
|
#7
|
|||
|
|||
|
hi Frank,
I have one more question related to the proximity sensor. I want the 2 clients (avatars) to see each other in the multi user environment. also, I want to calculate the distance between the 2 clients and make them do some thing when they are 5 meters far from each other. thanx. I appreciate ur help. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| input from a text file | dig | Vizard | 5 | 10-20-2013 02:20 AM |
| Lighting relevant text? | knightgba | Vizard | 1 | 01-26-2011 06:33 PM |
| Informationboxes with text | snoopy78 | Vizard | 3 | 07-16-2009 11:23 AM |
| Vizard tech tip: Text to Speech | Jeff | Vizard | 1 | 01-15-2009 10:39 PM |
| 3d Text with Transparent Borders | vjosh | Vizard | 3 | 12-01-2004 11:50 AM |