![]() |
Having a bot face one way, while moving another
Hellos!
I'd like to know what you guys think would be the best (cheapest, fastest) way to have a bot move in one direction, while looking in another. Please understand that my question is for a Quake 3 engine based game (so any examples will have to be in C ;) ). ATM, I basically just set the bots ucmd.angles to point to where ever its current goal is (waypoint, enemy, friend), and then set its ucmd.forwardmove to max (i.e. it turns to its goal, then runs forward). |
Re: Having a bot face one way, while moving another
There is the body/facing angles and then there is the movement direction (forwardmove, sidemove, etc.).
Just set the facing direction to one angle and set the movement direction based on a different angle (or vector). Using a movement angle would make things easy since you could get the forwardmove and sidemove values just by using sin() and cos() on the movement angle. botman |
Re: Having a bot face one way, while moving another
Quote:
However, one problem, my 3D math skills suck. How would I get those forwardmove, sidemove values? |
Re: Having a bot face one way, while moving another
dunno about quake3, maybe you can even set the movement direction by using a vector pointing to that direction or according pseudo polar coordinates ( 2 angles )
|
Re: Having a bot face one way, while moving another
sin() is used to find the Y axis direction and cos() is used to find the X axis direction (or if your axes are flipped, sin() for X and cos() for Y).
You would need to keep a bot variable (not in the edict) for the "direction angle" you want them to go. You can keep that in degrees if you aren't comfortable with radians (which is what sin() and cos() use as arguments). Let's say you call your "direction angle" variable 'a_dir' and you're keeping things in degrees (0-360). You could do something like this to set the forwardmove and sidemove values... Code:
float radians = a_dir * 3.14159f / 180.f; // degrees to radians botman |
Re: Having a bot face one way, while moving another
Thx Botman!
I'll give that info a try :) |
All times are GMT +2. The time now is 09:00. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.