[Pogamut-list] Rotation toLocation

michal.bida pogamut-forum at diana.ms.mff.cuni.cz
Wed Jul 11 11:04:52 CEST 2012


Re: Rotation toLocation

Author: michal.bida

toLocation is the method you want to use. E.g.

{CODE()}
Location OneHundredInFrontOfTheBot = info.getLocation().add(info.getRotation().toLocation().getNormalized().scale(100));
{CODE}

returns a location 100 ut units (~ 1 meter) in front of the bot. Just be careful - the vector will be in the same direction as the bot is currently looking to (so if the bot is looking up it will be above the ground). To account for this you can set the pitch attribute of the rotation you will be using to 0. 
I think that toLocation converts Rotation to normalized location vector (but I've added getNormalized() just to be sure).
You might also check DistanceUtils static class - there are some useful methods (mainly for distance computations).

-- 
Reply Link: <http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?forumId=6&comments_reply_threadId=6&comments_parentId=1007&post_reply=1#form>




More information about the Pogamut-list mailing list