[Algorithms] Where is the enemy?
Brought to you by:
vexxed72
From: Aldo . <al...@ho...> - 2000-07-24 12:38:03
|
Hi! I'm building the AI module of my game, but I have a problem. Imagine you as a space ship pilot in the deep space. Your enemy apears on the radar screen. You are at the "p1" position, "d" is your direction and "u" is your up vector. Your enemy is at the position "p2". How can I decide wich side must I turn? Something like this: auxVect = p2 - p1; Calculate relative position based on auxVect, d and u; if ( enemy at left ) yaw += turnSpeed; else yaw -= turnSpeed; if ( enemy is above ) pitch += tunSpeed; else pitch -= tunSpeed; I've tried cross product, but it doesn't worked fine. Any sugestions? Thanks in advance. Aldo ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com |