ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Which robot saw it? (Sdk)
Which robot saw it? // SdkesumerfdOct 8, 1998, 5:19pm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML> Lets say that I have my field full of deer. You remember the idea, 50 deer's wandering around a field, grazing, walking and running away from approaching people. <P>All these deer will be driven by the same program but there is no way for a program to know which deer noticed the approaching person first. <P>The aw_event_set(AW_EVENT_AVATAR_ADD, function); allows me to set a function to be called if an avatar approaches the bot within some distance. The function called is not passed any arguments to indicate which bot noticed the approaching avatar. <P>There should probably be a "void *instance" parameter passed to the function to indicate this. <P>It will not look good for all my deer to run away at the same time. <P>Edward Sumerfield.</HTML> roland vilettOct 9, 1998, 2:50am
This is a multi-part message in MIME format.
------=_NextPart_000_0007_01BDF305.A6F1EA60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable In this example, your AVATAR_ADD callback is going to be called 50 = times, once for each deer (assuming the person approached within range = of all 50). Within the context of your callback, just call = aw_instance() to determine which instance the callback is for. In the = first call to your callback, aw_instance() will be instance handle for = the first deer that saw it. Well, in theory, anyway. In practice, if the deer are close together, = the person is probably going to enter the "field of view" of several = deer simultaneously, since the world servers update the positions of = avatars relative to all others once per second. If within that one = second the person becomes visible to several deer at once, it's going to = be random which one gets the AVATAR_ADD first. -Roland [View Quote] The aw_event_set(AW_EVENT_AVATAR_ADD, function); allows me to set a = function to be called if an avatar approaches the bot within some = distance. The function called is not passed any arguments to indicate = which bot noticed the approaching avatar.=20 There should probably be a "void *instance" parameter passed to the = function to indicate this.=20 It will not look good for all my deer to run away at the same time.=20 Edward Sumerfield.=20 ------=_NextPart_000_0007_01BDF305.A6F1EA60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 = Transitional//EN"> <META content=3D'"MSHTML 4.72.2106.6"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT size=3D2>In this example, your AVATAR_ADD callback is going = to be=20 called 50 times, once for each deer (assuming the person approached = within range=20 of all 50). Within the context of your callback, just call = aw_instance()=20 to determine which instance the callback is for. In the first call = to your=20 callback, aw_instance() will be instance handle for the first deer that = saw=20 it.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Well, in theory, anyway. In practice, if the = deer are=20 close together, the person is probably going to enter the "field of = view" of several deer simultaneously, since the world servers = update the=20 positions of avatars relative to all others once per second. If = within=20 that one second the person becomes visible to several deer at once, it's = going=20 to be random which one gets the AVATAR_ADD first.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>-Roland</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> [View Quote] ------=_NextPart_000_0007_01BDF305.A6F1EA60-- |