DarwinBotsManual
Open the app EspañolES

.refveldx

How fast what you are looking at is moving sideways: positive toward your right, negative toward your left.

Facts

Address
697
Name
.refveldx
Kind
Sense: the engine writes it for the DNA to read
Group
What it sees (ref*)
Written by
The engine, in the actions phase of every cycle: the sideways velocity of what your focus eye sees, minus your .veldx. Positive, toward your right. Also on colliding with a bot. You read it in the next cycle.
Cleared
The engine, every cycle, when the senses are cleared.
Range
−32000 to 32000.
Mutations
picked as a read (*)

.refveldx is the lateral component of the velocity of the bot your focus eye sees, measured with respect to the direction you are looking and relative to your own sideways movement (.veldx). Positive: it is drifting off to your right. Negative: to your left. Its opposite is .refvelsx.

It uses the same convention as .dx, so copying it there makes you follow the other's sideways movement and not lose it from your front eye. It is half of the pursuit trick of .refvel:

cond
*.eye5 0 >
start
*.refveldx .dx store
stop

If you want to aim instead of moving, the alternative is to turn: a large value of .refveldx warns that the target is about to leave the eye. For precise aiming, look at .refxpos. If you see nothing, it is 0.