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 | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

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

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

**Physics Forums | Science Articles, Homework Help, Discussion**