# Tractor Trailer Physics

**URL:** <https://phaser.discourse.group/t/tractor-trailer-physics/3984>\
**Category:** Phaser 3\
**Created:** [October 17, 2019, 7:10pm UTC](https://phaser.discourse.group/t/tractor-trailer-physics/3984 "2019-10-17T19:10:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![inceabdullah](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/inceabdullah/32/2067_2.png) [@inceabdullah](https://phaser.discourse.group/u/inceabdullah)\
**Post date:** [October 17, 2019, 7:10pm UTC](https://phaser.discourse.group/t/tractor-trailer-physics/3984/1 "2019-10-17T19:10:08Z")

</div>

I have been trying to make a trailer parking game for long. After a long time I have just built the first goal that steering works!. But I don’t know how to make formula for trailer?

I made function for steering with that:

> ```
> if (cursors.up.isDown)
> {
> 
> this.__araba.body.angularVelocity = this.normal(this.__wheel.angle)
>     
> 
> this.physics.velocityFromAngle(this. __araba.angle-90, 300, this.__ araba.body.velocity)
> 
> // this.__araba.body.angularVelocity = -10
> }
> else if (cursors.down.isDown)
> {
> this.__araba.body.angularVelocity = this.normal(-this.__wheel.angle)
> 
> this.physics.velocityFromAngle(this. __araba.angle-90-180, 300, this.__ araba.body.velocity)
> }
> 
> ```

for normalization function:

> ```
> this.normal = (angle) => {
> if (angle === 0){
> return 0;
> }
> else if (angle > 0){
> return angle/90*100;
> }
> else if (angle < 0){
> return angle/90*100
> }
> }
> 
> ```

but. i don’t know how to make traile physics function.  
demo link: [https://html5.ozguruygulama.com/romork/dist/index.html](https://html5.ozguruygulama.com/romork/dist/index.html)
