[Pogamut-list] Spatial Reasoning with Rotation

michal.bida pogamut-forum at artemis.ms.mff.cuni.cz
Sun Oct 19 21:54:00 CEST 2008


Re: Spatial Reasoning with Rotation
Well in GameBots there is TURNTO command, where you can support location or even Id of the object/agent you want to look at. In client there should be some function that utilizes this command (look for turnto). There you just need to support object or location you want to face and it's done.

Now how does it work with Rotation and Pitch/Yaw/Roll. First you can forget about Roll - that is similiar to doing a cartwheel, roll should be always 0 for bots. Pitch is rotation upside down, yaw is rotation left/right. Full rotation is 65556 ut units. So if I want to look backward I'll issue ROTATE command with Amount 32778. If you want to face some exact location, you have to first count angle between two vectors (forget about z axis of vectors - set it to 0) - normalized vector of your rotation and normalized vector got as this ( location_you_want_to_face - bot_location ). When you have this angle you will multiple it by 182,1 and you get amount in UT units (we know that 360 degrees - full rotation corresponds to 65556 ut units - thats how we get the number). Afterwards you support this vector to ROTATE command and you are done (you will now face the location, but if z axis of vectors are different you would need to issue rotate command also to change pitch - you would ignore x and y axis of vector, get angle for z axis, multiple and issues ROTATE command).


I have to say that first solution with simple TURNTO is far simpler, so I suggest to use that. 

Cheers,
Michal

----

Reply Link: <https://artemis.ms.mff.cuni.cz/pogamut/tiki-view_forum_thread.php?forumId=5&comments_reply_threadId=313&comments_parentId=312&post_reply=1#form>





More information about the Pogamut-list mailing list