Hi! I'm new to the forum, so I'll present myself.(adsbygoogle = window.adsbygoogle || []).push({});

My name is Christoffer, I'm 24 years old, and i work as a programmer. I have an amatuerish interest in math an physics, and I'm not completely lost in the field of math.

I have however encountered a problem in a program I'm writing, and I'm stumped.

I am "simulating" (it's not really a simulation, it just needs to look good) a tank moving along a given path made up from points.

Each time I reach a new point in the path, I start turning to the next point while pushing the tank forward in the direction it's facing.

This all works fine, the problem is adjusting the tanks velocity, since some turns may be too sharp, and the tank may never reach the goal.

I calculate the movement like this:

I realize that I may need some other defined variables in order to make this work, but I don't really know what.Code (Text):to_next_path_point = next_path_point - position

dir_to_next = normalize(to_next_path_point)

dp = dot_product(dir_to_next, tank_forward)

angle = acos(dp)

rotation_this_update= tank_rotation_speed * delta_time

if angle < rotation_this_update

new_dir = dir_to_next

else

t = rotation_this_update / angle

new_dir = vector_lerp(tank_forward, dir_to_next, t)

end

new_position = position + new_dir * velocity * delta_time

I have to find out whether a given pathpoint is unreachable, and in that case decelerate.

Again, I'm not looking for the physically absolute correct way of calculating the turning radius, I'm just wondering if anyone has got a smart way of getting around this problem.

Thanks in advance

/ Christoffer

P.S Sorry if my english sucks :/

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Velocity based on turning-angle

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - Velocity based turning | Date |
---|---|

I Bases, operators and eigenvectors | Nov 15, 2017 |

B Does the L2 norm of a vector destroy all directional info? | May 24, 2016 |

Calculating the velocity planets need to have to be in circular orbit around a star | Sep 19, 2010 |

Coordinate Transformation - velocity? | Mar 12, 2009 |

Vector problem involving velocity and wind | Sep 18, 2007 |

**Physics Forums - The Fusion of Science and Community**