.veldx
The part of the bot's velocity that goes sideways toward its right; negative if it slides to the left.
Facts
- Address
- 198
- Name
.veldx- Kind
- Sense: the engine writes it for the DNA to read
- Group
- Movement
- Written by
- The engine, in the movement phase, after moving and turning the bot: the sideways velocity relative to the new heading. You read it in the next cycle.
- Cleared
- Nobody; the engine rewrites it every cycle.
- Range
- Between minus and plus
.maxvel; positive to the right. - Mutations
- picked as a read (
*)
.veldx measures how much the bot slides sideways, at a right angle to .aim: positive toward its right, negative toward its left. Together with .velup it describes the whole velocity; .velsx is the same figure with its sign flipped, and .velscalar is the total speed.
Since it is measured relative to the heading, a turn changes the split: a bot that moves straight ahead and turns a quarter turn to the left ends up sliding toward its right. The engine publishes it after moving and turning the bot; in the first cycle it is 0.
It's useful for canceling sideways drift by pushing the other way with .sx or .dx:
' if it slides to the right, pushes to the left
cond
*.veldx 0 >
start
*.veldx .sx store
stop