[Pogamut-list] Can't go backwards?

jakub.gemrot pogamut-forum at artemis.ms.mff.cuni.cz
Wed Oct 15 10:30:18 CEST 2008


Re: Re: Re: Re: Can't go backwards?
> 
>     public boolean action_moveBackwards()
>     {
>         this.log.info("Action MOVE BACKWARDS.");
>         Triple location = this.bot.getMemory().getAgentLocation();
> //point right in front of bot        
> Triple target = Triple.add(location, Triple.rotateYawPitchRoll(new Triple(50,0,0), bot.getMemory().getAgentRotation().x, 0, 0));
> //point right behind bot        
> Triple strafeLoc = Triple.rotateYawPitchRoll(Triple.subtract(target, location), Math.PI, 0, 0);
>         strafeLoc.normalize();    
>         
>         this.bot.getBody().strafeToLocation(strafeLoc, target);

I think the problem lies here ... strafeLoc and target are not vectors pointing somewhere (you want to run + you want to face) but absolute position within the world ... so you must do something like this
targetLocation = chosenNavPoint.location;
strafeToLocation( targetLocation, agentLocation );
// as strafe to location is always running directly to "targetLocation" specifying actual agentLocation will make the agent to look behind itself thus running backwards (not tested, should be working ;-)

Cheers! Jakub

----

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





More information about the Pogamut-list mailing list