ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
confused... (Sdk)
confused... // SdkdatamanOct 23, 1998, 5:40pm
I'm trying to get an avatar Model bot to walk smoothly and so far I'm
feeling rather moronic, maybe I just worked too late last night playin bone...anyway, when I just tell it to reposition 10 yards away it walks a few steps then GLIDES. When I use a for loop and wait in between baby steps it gets jerky. I did see this in the API docs and my poor little peanut brain is reeling: /* spin on a dime (45 degrees/second) */ for (yaw = 0; !aw_wait (1000); yaw += 450) { aw_int_set (AW_MY_YAW, yaw); if (aw_state_change ()) break; } While I am not really a structured programming freak, the break confuses me :) What's the condition that causes the loop to end? walter knupeOct 23, 1998, 5:49pm
The loop breaks if the aw_state_change returns a value not equal to 0, which
means when you run into an error while setting the new avatar position. I think bots move as other people do, they just need fewer repositioning steps which usually means that one repositioning is sufficient. the aw browser translates a sudden repositioning into a smooth move, (or a fast one if you move far in a short time). so the decision if you walk or glide is actually made in each users browser, therefore you can't really influence it (and you don't want to break down a move into several small steps because of that anyway :) ) Roland, if my observations are wrong, please correct them :) Walter Dataman schrieb in Nachricht <3630DBBC.AD0B298D at synergycorp.com>... >I'm trying to get an avatar Model bot to walk smoothly and so far I'm >feeling rather moronic, maybe I just worked too late last night playin >bone...anyway, when I just tell it to reposition 10 yards away it walks >a few steps then GLIDES. When I use a for loop and wait in between baby >steps it gets jerky. > >I did see this in the API docs and my poor little peanut brain is >reeling: > >/* spin on a dime (45 degrees/second) */ >for (yaw = 0; !aw_wait (1000); yaw += 450) { > aw_int_set (AW_MY_YAW, yaw); > if (aw_state_change ()) > break; > } > >While I am not really a structured programming freak, the break confuses >me :) What's the condition that causes the loop to end? > datamanOct 24, 1998, 6:32am
I'd have to say that's a wrong decision then hehe....it's a SLOW glide :)
[View Quote] > The loop breaks if the aw_state_change returns a value not equal to 0, which > means when you run into an error while setting the new avatar position. > > I think bots move as other people do, they just need fewer repositioning > steps which usually means that one repositioning is sufficient. the aw > browser translates a sudden repositioning into a smooth move, (or a fast one > if you move far in a short time). > > so the decision if you walk or glide is actually made in each users browser, > therefore you can't really influence it (and you don't want to break down a > move into several small steps because of that anyway :) ) > > Roland, if my observations are wrong, please correct them :) > > Walter > > Dataman schrieb in Nachricht <3630DBBC.AD0B298D at synergycorp.com>... roland vilettOct 24, 1998, 2:17pm
The trick with getting avatars to "walk" is that you have to kind of
second-guess the lifeforms avatar animation engine's decision about how to animate an avatar based on how far it has moved in a given amount of time. This is an elusive algorithm that even I don't grasp (I didn't write it). The bottom line is, it's based on how far your avatar moved in a given amount of time. One thing to keep in mind is that you don't have to update your avatar's bots position more than once per second (note to self, add this to the SDK docs); position updates more frequent than that will just be ignored by the server. A "typical" walking rate is about 1.3 meters per second...so if you space your position updates out so that they are 1 second and 1-2 meters apart, you should see the avatar appear to "walk" (assuming it has a walking animation sequence available of course). -Roland [View Quote] |