Ols (Away)

Sign in to follow this  
  • entries
    18
  • comments
    17
  • views
    5588

Ols - SOHCAHTOA/f&*k radians

Sign in to follow this  
ols

180 views

Spent the last few days trying to get my head around the AI algorithm I am writing. It involves being able to 'view' the map from the cars' perspective, and so has taken a LOT (i.e. a HUGE amount) of trigonometry work.

All those days spent in school with various teachers going through sin, cos and tan - where I was SO sure that there would be zero relevancy in later life - finally come to fruition some 8 or 10 years down the line. How I now appreciate them!

Have hit two large stumbling blocks along the way. Firstly I forgot about the four different quadrants in a circle and how the calculations would have to be different for each quadrant in order to get the correct result. Cue a large amount of time spent with pens, paper - lined & squared! - rulers and an unsuccessful search for a protractor (?sp) - again, I had no idea that it would ever come in handy so I probably chucked it.

Once I had got over this hurdle everything seemed to be coming along nicely until it stopped doing so! In my infinte wisdom I had somehow failed to realise that I should have been working in radians rather than degrees. D'OH! Although, more confusingly, I am sure that I did everything in degrees when working with matrix rotation in DirectX - too scared to look back at the code now as it is working fine and so there is just no need to tempt fate!

Back to the pen, paper, etc again as I tried to remember more recent - but far more confusing - maths lessons involving radians and pi et al

But, glad to say, once this was beaten it now appears that this part of the algorithm is working nicely - strangely not 100% accurate, but I think that this will, handily, add to the realism of the AI.

Next to do is to make use of this algorithm and get the AI car moving. Somehow I feel that those sixteen words dont do justice to the amount of work it is sure to encompass, but here goes nothing......
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now