Register to reply

Velocity based on turning-angle

by christoffer_s
Tags: based, turningangle, velocity
Share this thread:
Sep29-11, 08:09 AM
P: 1
Hi! I'm new to the forum, so I'll present myself.
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:

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
   t = rotation_this_update / angle 
   new_dir = vector_lerp(tank_forward, dir_to_next, t)

new_position = position + new_dir * velocity * delta_time
I realize that I may need some other defined variables in order to make this work, but I don't really know what.
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 :/
Phys.Org News Partner Science news on
Scientists develop 'electronic nose' for rapid detection of C. diff infection
Why plants in the office make us more productive
Tesla Motors dealing as states play factory poker

Register to reply

Related Discussions
Length of a pendulum based on speed and max angle Introductory Physics Homework 10
Please set me straight about velocity based time travel Special & General Relativity 1
Calculate displacement based on velocity and acceleration Introductory Physics Homework 3
Velocity based frictional force equations Introductory Physics Homework 2