Thread

Bot positioning... (Sdk)

Bot positioning... // Sdk

1  |  

byte me

Oct 24, 1998, 7:08pm
Ok I was wondering if
AW_MY_X, AW_MY_Y, AW_MY_Z, AW_MY_YAW and use the AW_AVATAR_X,Y,Z,YAW if
it is inside avatar change :)

byte me

Oct 25, 1998, 2:05pm
Yes but is there a way to make my bot mvoe to the coords of the avatar
it noticed?

[View Quote]

edward sumerfield

Oct 25, 1998, 2:06pm
The MY are your robots position and the AVATAR is the position of the avatar
that your bot noticed.

[View Quote]

edward sumerfield

Oct 25, 1998, 4:37pm
Certainly,

handler_avatar_add {

get AVATAR_X
get AVATAR_Y
get AVATAR_Z
get AVATAR_YAW

set MY_Z to AVATAR_X
set MY_Y to AVATAR_Y
set MY_Z to AVATAR_Z
set MY_YAW to AVATAR_YAW
aw_state_change
}

This will move you to exactly the same place as the avatar you have noticed.

Now the mathematical problem you have is working out how to put yourself
infront of and facing the avatar. Here is the algorithm:

distance from avatar required = 1000; /* 1 meter */

avatar direction in radians = (avatar yaw / 10) * (2PI/360);

Infront X = Avatar X + (distance * sin(avatar direction));
Infront Y = Avatar Y + (distance * sin(avatar direction));
Infront Z = Avatar Z + (distance * cos(avatar direction));
Infront YAW = (Avatar yaw + 1800) moduls 3600;

Some details to note:

1. The Ansi sin and cos functions take radians instead of degrees.
2. 360 degrees = 2*PI radians
3. Active world angle = 1/0 degree.

If you look at the Movement::modifyPosition method in the C++ AWCPP source
file Movement.C it shows you this logic for moving an avatar forward a
specific distance.

Hope this helps.

Edward Sumerfield.

[View Quote]

byte me

Oct 25, 1998, 8:26pm
Is that C or C++? :)

[View Quote]

jw

Oct 25, 1998, 8:49pm
Its E++ :)

[View Quote] > Is that C or C++? :)
>
[View Quote]

walter knupe

Oct 25, 1998, 10:40pm
Jw schrieb in Nachricht <3633AAFA.4005158D at mediaone.net>...
>Its E++ :)
>
[View Quote]
yep, E++ ... right LOL

anyway..

yourself


i don't know if it makes much sense to calculate an altitude angle... in
order to face somebody, just use the same altitude... (which is the Y
factor)

Walter

edward sumerfield

Oct 26, 1998, 1:55am
Exactly Walter. My appologies that is a typo. In reality it should read
"avatar vertical direction" which in your case will always be zero.

Edward Sumerfield.

[View Quote]

edward sumerfield

Oct 26, 1998, 11:06am
You know, that wasn't accurate either. The Y coordinate should remain
exactly the same as the avatars Y coordinate. After all, if an avatar is
flying over head you would want to run up to meet them wouldn't you.

So that same line should read.

Infront Y = Avatar Y;

Edward Sumerfield.

[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn