## Determining vehicle direction on roads

Learn here how to create and use plugins.

Moderator: Plugin Moderators

CommanderABab
AB
Reactions:
Posts: 7433
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

### Determining vehicle direction on roads

How to change the standard movement on roads:

innerr.png (2.04 KiB) Viewed 787 times
Subtile Order of Each Road Tile:

..........
..... 2
. 0 3
..... 1
..........

Moving direction is the sum of:
(This is from one of the subtiles above; a vehicle has reached this spot, the sum equals the possible directions it can go from here.)
1
2
4
8

So, "No direction" would be 0. Thus the vehicle would stop and most likely despawn. All directions would be 15 (for intersections).

An example of dirs for a two way road (24 number array):
(Dirs need to be provided for the frame in the comments, the others are determined from these)

Code: Select all

    "dirs":[
12,9,3,6 , //0
1, 1, 8,4,  //1

1,1, 8, 2,  //3

9,9,6,6, //5

1, 3, 12, 6,  //7

13,11,14,7 //15
]

An example of dirs for a one way road (64 number array):
(One for each of the first 15 road frames, the others are adapted from these.)

Code: Select all

      "dirs":[
0,0,0,0,
1,1,1,1,
2,2,2,2,
1,1,9,1,
4,4,4,4,
9,9,3,3,
3,2,2,2,
3,3,3,3,
8,8,8,8,
3,3,1,1,
6,3,6,3,
3,3,3,3,
9,8,9,8,
9,9,9,9,
6,6,6,6,
11,11,11,11
]
Note: the numbers in these examples are from my b3.plugin, which allows non-standard road movements so that cars can switch lanes across 3 or more lanes from the inner 2 way road straight sections across the straight sections of the one way roads placed adjacent. Thus, the cars may be seen driving off the side of ramps.
719🆎️

CommanderABab
AB
Reactions:
Posts: 7433
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

### Re: Determining vehicle direction on roads

So, you may see the t intersection directions better.

7,11,13,14 above are the t intersections. The yellow line though the center has breaks instead of being solid.
719🆎️

Mg3094066
Inhabitant of a Supercluster
Reactions:
Posts: 3096
Joined: Sun May 28, 2017 1:50
Location: United Mexican States
Plugins: Show
Version: Beta
Phone model: LG H320mb 5.0.1

### Re: Determining vehicle direction on roads

Aaaaaaa my head will exlode D:
I want my diamonds you get the plugins free or not

danekbel
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2769
Joined: Thu May 05, 2016 9:33
Plugins: Show
Version: Beta
Phone model: person, who uses cracked software and doesn't see why it's a bad thing N-1

### Re: Determining vehicle direction on roads

i think it's time to throw my brain to the trash can
some text.

CommanderABab
AB
Reactions:
Posts: 7433
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

### Re: Determining vehicle direction on roads

CommanderABab wrote:
Fri Jul 20, 2018 4:25
How to change the standard movement on roads:

Subtile Order of Each Road Tile:

..........
..... 2
. 0 3
..... 1
..........

Moving direction is the sum of:
(This is from one of the subtiles above; a vehicle has reached this spot, the sum equals the possible directions it can go from here.)
1
2
4
8

So, "No direction" would be 0. Thus the vehicle would stop and most likely despawn. All directions would be 15 (for intersections).

An example of dirs for a two way road (24 number array):
(Dirs need to be provided for the frame in the comments, the others are determined from these)

Code: Select all

    "dirs":[
12,9,3,6 , //0
1, 1, 8,4,  //1

1,1, 8, 2,  //3

9,9,6,6, //5

1, 3, 12, 6,  //7

13,11,14,7 //15
]

An example of dirs for a one way road (64 number array):
(One for each of the first 15 road frames, the others are adapted from these.)

Code: Select all

      "dirs":[
0,0,0,0,
1,1,1,1,
2,2,2,2,
1,1,9,1,
4,4,4,4,
9,9,3,3,
3,2,2,2,
3,3,3,3,
8,8,8,8,
3,3,1,1,
6,3,6,3,
3,3,3,3,
9,8,9,8,
9,9,9,9,
6,6,6,6,
11,11,11,11
]
Note: the numbers in these examples are from my b3.plugin, which allows non-standard road movements so that cars can switch lanes across 3 or more lanes from the inner 2 way road straight sections across the straight sections of the one way roads placed adjacent. Thus, the cars may be seen driving off the side of ramps.
719🆎️

CommanderABab
AB
Reactions:
Posts: 7433
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

### Re: Determining vehicle direction on roads

Code: Select all

    "dirs":[
12,9,3,6 , //0
1, 1, 8,4,  //1
1,1, 8, 2,  //3
9,9,6,6, //5
8, 1, 6, 6,  //7
8,1,4,2 //15
]

Where will it go?

719🆎️

### Who is online

Users browsing this forum: No registered users and 1 guest

﻿