Thread

Yaw calculations? (Sdk)

Yaw calculations? // Sdk

1  |  

recils

Feb 28, 2000, 3:05am
Alright, my bot moves from point A to point B fine. The problem is it
sometimes does it backwards, sideways, etc. I need to find an equation
which calculates yaw based on a given set of two points, the bot's current
X/Z and it's target X/Z thanks for your help.
-RecilS

brez

Feb 28, 2000, 4:26pm
you have to manipulate the yaw while manipulating your
x/z planes; unfortunatly there's no simple equation that will
work in every situation... what's really going on in "backwards, sideways,
etc" is that the yaw is remaining constant while
your x/z planes are changing (Einstein would have preferred
this model over the two trains at the train station, I reckon)...

if you can't figure it out, send me what you got and I'll have
a go at it..

btw, who the h*** posted "Checking for URLs" under the guise
of brez? ....whoever it was, you'll have to query each
individual object for the URL zone by zone, and GUIs take too
long to develop (in C anyhow), just to cater to the lazy.

brez


>Alright, my bot moves from point A to point B fine. The problem is it
>sometimes does it backwards, sideways, etc. I need to find an equation
>which calculates yaw based on a given set of two points, the bot's current
>X/Z and it's target X/Z thanks for your help.

serac

Feb 28, 2000, 7:05pm
Actually the solution is just very simple geometry/trigonometry. I
hesitated to reply, because it is murder to try to explain in a text-only
e-mail message. :o)

There isn't a *single* equation to solve the problem. So, it just takes
seven equations (assuming I did the mental math correct). Three of the
equations are only just simple assignments based on rules. The other four
are also based on rules, but the actual equation is almost identical in each
case.

Here are the first three rules:

Define dx = (x_1 - x_0) ; dz = (z_1 - z_0)

1) If dx = 0 and dz = 0, then yaw = UNDEFINED
2) If dx = 0 and dz < 0, then yaw = 180000 (South)
3) If dx = 0 and dz > 0, then yaw = 0 (North)

If none of these rules apply, then use the following rules:

Define PI = 3.1415926535897932384626
Define theta = [ arctan ( dz / dx ) * ( 180000 / PI ) ] - 90000

4) If dx > 0 and dz > 0, then yaw = theta (Quadrant I)
5) If dx < 0 and dz > 0, then yaw = 180000 - theta (Quadrant II)
6) If dx < 0 and dz < 0, then yaw = 180000 + theta (Quadrant III)
7) If dx > 0 and dz < 0, then yaw = 360000 - theta (Quadrant IV)

Whew... I guess that wasn't that hard to explain. I only hope I've done the
math correctly. AW should have used the normal coordinate system. :o)

NOTE: It's been awhile since I've worked with the SDK. I am assuming that
YAW values are scaled by 1000 just like all other coordinates. If this is
incorrect, please make the appropriate changes.

I hope this will help you. Even if I've goofed, it shouldn't be too hard to
fix it. If you are utterly confused, just reply back and I can try to
confuse you more. :o)



[View Quote]

recils

Feb 29, 2000, 3:43am
Oh thats great dude, thanks for the math.
I'm assuming I plug in the tangent of the triangle fo arctan. I'll have to
put that function into vb but that'll take like 2secs.Thats really cool, now
my blimps and such wont try to do the moonwalk and impress everyone.

BTW here is what my bot is being designed to do -

Basics :
o Basic AI functions (Not too cheezy, just small talk, weather, etc)
o Land reservation (Covers any ammount of land with any object quickly) :
Done
o Random motion including motion patterns
o Music
o Building repetition patterns. Need a 10000ft spiral staircase? Np

Cool Stuff :
o Advanced building AI. I am in the process of 'teaching' the bot to
understand architecture including the concepts of walls, flooring, ceilings,
entrance passages 'decoration', road access, location, etc.
This will allow the bot to create entire citys or world in minutes.
o Shadowing (Will create 'shadow' by moving a translucent box as the person
moves to give the impression of darkness)
o Hindenberg scenario : Blimp flys around randomly, every once in a while
crashes in flames. (Really cool =)

If you'd like to know more, talk to me on this news server.
(Im also at 755S 1515W AW and a part owner of AtomicF world)



[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