-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|699|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs

Pakz Created : 26 May 2022
Edited : 26 May 2022

### Nature Of Code (avarage heading) - books

With working on a racing game. This book 'nature of code' keeps being a reference. My math skills are not good. I do understand a bit more every time I try to learn more about that.

I was trying to figure out a way to have cars on a race track be able to stay apart from each other. And follow each other too. In the book there is a lot of this.

I now also think to understand 'average heading' In stead of adding up every bots angle and dividing by the number of bots. I now do the x(cos) and y(sin) and the division. (See code)

Another new book I got this week tought me some new math. This 'orientation' function. Where you find which side a point is besides a line. Can be used for all sorts of collision. Say you have a point outside a triangle. If this point is besides each line of a triangle. Then there is no collision? I still need to read the book more indepth. I was using this isleft function for turrets and homing missiles and such.