Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: Testlund on December 04, 2013, 10:58:33 AM

Title: Setting a bots angle
Post by: Testlund on December 04, 2013, 10:58:33 AM
Why do these two work exactly the same?

 *.refxpos *.refypos angle .setaim store

 *.refxpos *.refypos angle sub .setaim store

Shouldn't the latter change the bot to opposite direction?
Title: Re: Setting a bots angle
Post by: Testlund on December 04, 2013, 11:38:05 AM
There is something not right with the .hit sysvar. The code below will make a bot turn away from a shape when it SEES it!

Code: [Select]
'Movement debugger

cond
 *.hit
 *.reftype 1 =
start
 *.refxpos *.refypos angle .setaim store
 628 .aimright store
stop
Title: Re: Setting a bots angle
Post by: Testlund on December 04, 2013, 11:47:02 AM
It's impossible to make a bot turn a half circle and swim backwards!  :banghead:
Title: Re: Setting a bots angle
Post by: Botsareus on December 07, 2013, 10:22:09 AM
By swim backwards do you mean something like 10 .dn store?
Title: Re: Setting a bots angle
Post by: Botsareus on December 07, 2013, 10:35:47 AM
If you want the robot to turn but still move in the same direction you have to memorize the angle and use sin cos commands.
Title: Re: Setting a bots angle
Post by: Testlund on December 07, 2013, 12:41:41 PM
"COS" is another thing I need to learn, but I've figured out a way for bots to handle shape. I'll upload a sim example soon. Going to check out 2.46C now.