Path: chuka.playstation.co.uk!news From: "pal" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Splines Date: 18 Jul 2002 09:26:21 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 22 Message-ID: <01c22e3c$0e61c880$f6a0933e@pal-s-omnibook> References: <3D35F1CD.6090504@100Tinsoldiers.com> NNTP-Posting-Host: nas-cbv-9-62-147-160-246.dial.proxad.net X-Newsreader: Microsoft Internet News 4.70.1155 Nigel Critten wrote in article <3D35F1CD.6090504@100Tinsoldiers.com>... > I want the object to point in the direction of movement, I'm assuming I > can use the difference between the x,y from one from to the next and > pass that in Atan2 (dx, dy) to get the angle, again right or wrong? Right, but according to atan2's precision (or your dx,dy's) you may encounter problems. Imagine your object is following a straight line (the problem will be the same with a spline) from 0,0 to 1,9: its path at speed == 3 will become something like 0,0 -> 0,3 ; 0,3 -> 1,6 ; 1,6 -> 1,9. You can see it's never pointing properly. I dont know what the proper solution is; mine was to have a high precision in dx,dy (so that 0,0 -> 0,3 becomes 0.000,0.000 - > 0.333, 3.000). You may consider going float, but I'm not sure how atan2 would handle that. If your object's never going too slow this may just not happen though. Also if needed beware to consider the case where dx,dy == 0, which atan2 won't be able to solve correctly. pal