What you’ve got looks good so far, but I guess you’re not too sure about
def update(steering, time):
position += velocity * time + .5 * steering.linear * time * time;
orientation += rotation * time + .5 * steering.angular * time * time;
velocity += steering.linear * time;
orientation += steering.angular * time
What that is, is a function that would be called as part of the game’s update loop.
In Unity, you’d put it in one of the Update calls, or you could have an infinite loop that calls yield when it’s done, meaning it’ll get called once per frame, I think. (You may want to check which Update call or yield is best practice for Unity.)
I’ll just assume your OnUpdate is called once per frame. What you’ll need is code to handle user input, interacting with an instance of the SteeringOutput struct. In the pseudo code, it is passed to the update function and called steering, but if this script handles user input and the update (not ideal, but I think is doable in Unity) you can just have it as a local variable and not worry about passing it. The same goes for the psuedo code’s “time” parameter; can be kept in the single script.
So, what you’d do is something like the following:
private SteeringOutput m_output;
privete Timer m_time; // Not sure what the time class is called in Unity.
// other vars
void Start()
{
m_steering = new SteeringOutput();
m_time = Time.Now();
// etc
}
void OnUpdate(/*pseudo code passes sterring/time here*/)
{
TimeSpan dT = Time.Now() - m_time;
// Move object
position += velocity * dT + .5 * m_steering.linear * dT * dT;
orientation += rotation * dT + .5 * m_steering.angular * dT * dT;
// Update vel and orientation for next frame.
velocity += m_steering.linear * time;
orientation += m_steering.angular * time;
// The above formulae should all work as they are,
// but you might want to add brackets for
// clarity and fix any syntax errors.
m_time = Time.Now();
}
void OnUserInput(/*params here*/ )
{
// Update m_steering based on user input.
}
I think that is pretty much what you’d need to get going. Like I say, though, the syntax of Time is probably wrong (I suspect if there is a timespan class, you’d need to calculate that and then get the milisecond value; dT.miliseconds or some such) and Unity’s vectors might not support operator overloading, so you may have to adjust the formulae accordingly, but I’d be surprised if they didn’t. Also, I’m not sure what is passed for user input event, so that’ll require looking up too. One final note: even though the time and steering data is handled in the same script, this is not good OO design, but that is up to you.
Hopefully at the very least this has given you something to build upon. 