- Home /
Accelerating smoothly to a given level
Hi there. I'm tinkering with a basic 3D submarine game and want to make my sub level out smoothly at a given depth.
In manual control, the bow angle is controlled by the vertical axis. Its value is applied to a rotational acceleration which is added to a rotational speed around the X-axis (making it point up/down smoothly). The angle is subsequently clamped to +/- 80 degrees. The vessels position is then calculated by angle * speed thus increasing/decreasing depth.
However, I wish to set a depth and have the sub automatically 'slerp' to that depth using its usual rotational acceleration/speed values to calculate the slopes and curves.
I'm not sure how to calculate when the vessel should begin to level out in time to get to the correct depth.
Can anyone suggest the correct way to go about this or point me towards the correct formulas?
simply set a ConstantForce.
each frame, look at the velocity, or depth, or what have you. When it has reached the value you want, eli$$anonymous$$ate the ConstantForce!
Don't forget you would have Drag in water
Answer by yhp · Dec 27, 2012 at 10:22 PM
I'm not using physics, want to avoid doing that if at all possible. Even if I was i'd still require the angle of attack to decrease before the assigned value. Also, the sub passed the assigned value and it still had vertical velocity then it would pitch the opposite direction to try to get to it creating a bobbing motion.
I need the angle of attack of the sub to decrease before it gets to the assigned depth and level out smoothly rather. I'm sure this problem must be similar to making a car steer to a certain heading smoothly or making a car stop on a given spot employing smooth movements. My usually good googling is failing me.
Your answer
Follow this Question
Related Questions
Input Acceleration low-cut + smooth 1 Answer
Help me out with a simple smoothing function for accelerometer data? 1 Answer
Accelerating an object for a brief time then back to normal speed 1 Answer
Airplane smooth acceleration problem 0 Answers
How you change another script value smoothly on trigger 0 Answers