Unfortunately, my project is currently broken at the moment. I think I know how to remedy this, but I cannot try to fix it until later today.
Until then, I want to focus on how to set up velocity fields. Storing velocities from the hand motion should be easy now that the directional heading control is almost functioning correctly. Instead of updating the agents' positions immediately based on the velocity samples, the agents would be held in place and the samples would be stored in a grid mapped to the game space. Then when the user is finished setting up the field, they can let the agents 'go', letting them be affected by the velocities stored in the grid. My biggest concerns are entering and exiting this mode so that the agents stay in place until the user is ready to let them go and finding a good grid size; cells that are too small may cause the agents to end up appearing confused or stuck. What will really be cool is getting the velocities in one cell to influence the agents' current velocities, rather than just giving the agents a new target, causing them to change direction abruptly. This will start to give the agents more natural and fluid-like motion.
So realistically, my first goal is to set up functions for storing velocities from hand movements and applying velocities to agents. Then I need to build a simple grid structure and map it to the game space. Combining the two should allow for a very basic velocity field control feature.
That's it for now!
Marley
I agree with the latter half of the discussion about using velocity fields.
ReplyDeleteThe velocity field should affect the "desired velocity" of agents that arrive in that grid. Agents should then smoothly accelerate/decelerate to achieve the new desired velocity. (this should be handled transparently by the steering algorithm).
Regarding grid discretization, a good thumb rule for minimum is to make one grid unit the size of the agent. I would actually make it larger, maybe 2X or even 3X for starters.
Also, when painting a velocity field: you want to keep in mind that the field does not have any discontinuities.
So: when you are painting the velocity at a particular grid, it should affect the neighboring grids as well ...