# Tractor - Trailor physics

This topic is 4968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am trying to set up physics for a vehicle towing a trailor. The set up of the situation is such: C(x,y) - Position of vehicle P(x,y) - Position of hitch (pivot point) E(x,y) - Position of end of vehicle length1 - length between pivot point and end of vehicle angle1 - Direction of Vehicle angle2 - Direction of End of Vehicle The vehicle will be driven, and the trailor has to rotate and follow the vehicle correctly. Does anyone know how to calculate this problems given the above variables? Or know of another method that works?

##### Share on other sites
It could be a big and hard problem, maybe using a physics engine will make easier for you.
Check out ODE it is open source.

##### Share on other sites
I should clarify that it does not have to be a mass-momentum system. I have to integrate this problem into a real-time system with a window of 500 micro-seconds.

If it is first order approximation, that would be fine. Any suggestion would be of help at this point.

##### Share on other sites
interesting problem.

This is mostly kinematics (no need for forces), if slippage is ignored (low speed towing, no skidding or fast cornering).

for a standard vehicle, the path can be calculated relatively easily. It's all to do with the wheelbase, and angle at the wheels. Then the centre of rotation can be found, and the car rotated.

##### Share on other sites
that's the setup

              ===             /      |           |------|--0        /      |                 ===

which can be simplified

                        <--w-->                   -----/-----===-0       a \     |                     \    |             \   | r             \  |               \ |                 \|                 C

w (wheelbase) is a known quantity
a (steering angle) is also known.
r (turning radius) can be deduced, as well as C (centre of rotation).

then, the next position and angle of the car can be calculated, given the tangencial velocity, and the frame time.

##### Share on other sites
then, the position of the anchor point O can be found.

Now, the trailer...

the trailor has a fixed length. So the wheel of the trailor should be on the circumference of a circle centred around the anchor point.

the natural position of the wheel when the anchor is displaced is where the work is minimum. That is, the point on the circle the closest to the current position of the trailor.

That's just an approximation, of course. It's just what should happen naturally. It's not considering the impact of the trailor on the tractor itself, or any extreme behaviours, like wheel locks, and slippage.

##### Share on other sites
in picture

    O'    O      .    \            .  \ l         W' .\                 W

O (anchor) and W(centre of the trailor axle) are given at the start.
l is the trailor wheelbase.

O' is then calculated using the previous algorithm to move a vehicle.

W' is then calculated, as being also at distance l from O'.

at the same time W' is such as the segment W-W' is miunimum. i.e., W' is the point on the cricle (O', l) the closest to W.

##### Share on other sites

But having trouble following what you are saying. Could you lay it out in a more step-by-step manner?

Thanks,

PS

##### Share on other sites
OK, forgeting about the way the tractor moves, all you have to worry about in my opinion is the positions of the trailor anchor attached to the tractor.

basiccally, no matter what, the trailor's wheel axle will always be at a fixed distance from the anchor (unless your trailor can stretch, which I doubt :)).

secondly, from what I've seen of trailors (I've done work at the old farm :)), the wheel will move in such a way that the axle will pivot and move towards the point where there is the least amount of work to be done. That is, the wheel axle will tend to move as little as possible.

Imagine a tight turn, the axle will barely move. In reverse, the axle do so as well, hence the difficulty of reversing with a trailor.

That's my instinct anyway. If you don't use a physics engine, or use complex kinematic equations, you'll have to start to make assumptions. I'll try that first, since you require a simple solution, and that is the simplest it can get.

##### Share on other sites
in psuedo code

void CTrailor::Update(){    const CTractor* pxTractor = GetTractor();    Vector xAnchor = pxTractor->GetAnchor();    Vector xPosition = GetAxlePosition(); // position of the axle.    const float fWheelBase = GetWheelbase(); // fix distance from the axle to the attachment on the trailor.    Vector xDir = xAnchor - xPosition;    xDir.Normalise(); // new direction of the trailor.    xPosition = xAnchor - xDir * fWheelbase;    // new position of the wheelbase relative to the anchor point, such that the trailor length is kept constant.    SetAxlePosition(xPosition); // new position of the wheel axle    SetDirection(xDir); // new direction of the trailor}

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 31
• 16
• 11
• 10
• ### Forum Statistics

• Total Topics
634121
• Total Posts
3015613
×