.refvel
How fast what you are looking at moves away (positive) or comes closer (negative), in the direction you are looking and relative to yours.
Facts
- Address
- 699
- Names
.refvel,.refvelup- 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 velocity of what your focus eye sees along your viewing direction, minus your
.velup. Positive if it is moving away. 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 (
*)
.refvel, also called .refvelup, is the velocity of the bot your focus eye sees measured along your line of sight, and relative to yours: the engine subtracts your own .velup from it. Positive means it is moving away from you straight ahead; negative, that it is coming closer.
Its exact opposite is .refveldn, the sideways component is .refveldx and the total is .refvelscalar.
It uses the same convention as .up, and that is why the classic trick is to copy it there: if the other moves away, you push so as not to fall behind. Animal Minimalis adds a little to it so as to also close in:
cond
*.eye5 0 >
*.refeye *.myeye !=
start
*.refveldx .dx store
*.refvel 30 add .up store
stopWith this gene, plus one that turns when it sees nothing, the bot chased a fleeing target and kept it in .eye5 almost without losing it for about 50 cycles.
If you see nothing, it is 0. Against a shape, it measures the shape's velocity.