Jump to content


Photo

Easy Roads 3


  • Please log in to reply
34 replies to this topic

#21 Stingreye

Stingreye

    Advanced Member

  • Members
  • PipPipPip
  • 341 posts
  • LocationSouthern California

Posted 24 February 2019 - 07:24 PM

I'm doing the Blender cart paths and so far, I'm digging them.
Now mind you, the powers that be, I hope, are working on pieces for a "Y" but for now, these babies stick right to the ground and join seamlessly.
Just throwing that out there.

Peace

1dy4FHv.png


Those look VERY nice!
  • axe360 likes this

#22 clubcaptain

clubcaptain

    Advanced Member

  • Members
  • PipPipPip
  • 1,310 posts

Posted 02 April 2019 - 12:07 AM

using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using EasyRoads3Dv3;
using EasyRoads3Dv3Editor;

public class ERAPIEditor : ScriptableObject {

	[MenuItem( "EasyRoads3D/Custom Road Shape" )]
	public static void   RefreshRoad() 
	{
		ERRoad road = EREditor.GetSelectedRoad();

		if(road != null){

			List<Vector2> shape = new List<Vector2>();
			List<float> uv = new List<float>();
			List<bool> tris = new List<bool>();

			shape.Add(new Vector2(3f,0f));
			uv.Add(1f);
			tris.Add(true);

			shape.Add(new Vector2(2.9f,0.05f));
			uv.Add(0.99f);
			tris.Add(true);

			shape.Add(new Vector2(0f,0.1f));
			uv.Add(0.5f);
			tris.Add(true);

			shape.Add(new Vector2(-2.9f,0.05f));
			uv.Add(0.01f);
			tris.Add(true);

			shape.Add(new Vector2(-3f,0f));
			uv.Add(0f);
			tris.Add(true);

			road.roadScript.roadShape = new List<Vector2>(shape);
			road.roadScript.roadShapeUVs = new List<float>(uv);
			road.roadScript.doConnectionTri = new List<bool>(tris);

			road.roadScript.isCustomRoad = true;

			foreach(ERMarkerExt m in road.roadScript.markersExt){
				m.roadShape = new List<Vector2>(shape);
			}

			road.Refresh();

		}else{
			Debug.Log("Please select a road object first");
		}
		Debug.Log("done");
	}

}

Thats the script.  You can see the variables in how it adds the Vector2. 

EDIT: also, I think the file I posted has the comments removed, but you need to remove the comments before using

EasyRoads3Dv3;

using EasyRoads3Dv3Editor;

I removed them in the script above.

EDIT2:  Ok with the help of Shimonko,  he helped me understand the script.

So with the script above the following is the graphic Shimonko gave me to help understand the road.

unknown.png

 

And here is a sketchup I did to show how the variables are linked,  its not pretty but helps me understand it.

unknown.png

 

And then even with that great explanation and thinking I understood it, I still managed to mess it up but Shimonko was patient and helped me with it.

Here is the modified code that will work for cart paths that are 3 wide like mine.

using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using EasyRoads3Dv3;
using EasyRoads3Dv3Editor;

public class ERAPIEditor : ScriptableObject {

	[MenuItem( "EasyRoads3D/Custom Road Shape" )]
	public static void   RefreshRoad() 
	{
		ERRoad road = EREditor.GetSelectedRoad();

		if(road != null){

			List<Vector2> shape = new List<Vector2>();
			List<float> uv = new List<float>();
			List<bool> tris = new List<bool>();

			shape.Add(new Vector2(1.5f,0f));
			uv.Add(1f);
			tris.Add(true);

			shape.Add(new Vector2(1.4f,0.1f));
			uv.Add(0.99f);
			tris.Add(true);

			shape.Add(new Vector2(0f,0.1f));
			uv.Add(0.5f);
			tris.Add(true);

			shape.Add(new Vector2(-1.4f,0.1f));
			uv.Add(0.01f);
			tris.Add(true);

			shape.Add(new Vector2(-1.5f,0f));
			uv.Add(0f);
			tris.Add(true);

			road.roadScript.roadShape = new List<Vector2>(shape);
			road.roadScript.roadShapeUVs = new List<float>(uv);
			road.roadScript.doConnectionTri = new List<bool>(tris);

			road.roadScript.isCustomRoad = true;

			foreach(ERMarkerExt m in road.roadScript.markersExt){
				m.roadShape = new List<Vector2>(shape);
			}

			road.Refresh();

		}else{
			Debug.Log("Please select a road object first");
		}
		Debug.Log("done");
	}

}

I personally like the thicker road look and it should provide more forgiveness from floating roads that can happen with EasyRoads.

 

Some more pics: path with spline off:

unknown.png

 

Path with spline on:

 

unknown.png

 

A great view of what this script actually does (you will notice shimonko's drawing mimics this).

unknown.png

 

NOTE: I think it causes trouble with pefab connnections, so depending on how you do your connections (I don't use connectors yet).

 

Matt, I think this will work with free version of v3.0.  I don't see why it wouldn't.  Let me know if you have any questions. Please note I am still a rookie with unity, CF, and easyroads.

 

How do you implement this script. Do you place it as it is shown above into standard assets/scripts or does it need to be in it's own folder in standard assets/scripts. Does this script provide a drawing and editing facility or does some version of Easy Roads (not V 3) also need to be installed ?


PC specs...

Intel core I7 9700k 3.6 GHZ-Turbo 4.9 GHZ
64 GB Corsair vengeance  LPX DDR4 2400 MHZ
Asus PRIME Z390-P 
Nvidea GeForce RTX 2060 6GB
X box 360 wired controller
Windows 10 PRO NA 64 bit


#23 Stingreye

Stingreye

    Advanced Member

  • Members
  • PipPipPip
  • 341 posts
  • LocationSouthern California

Posted 02 April 2019 - 12:11 AM

How do you implement this script. Do you place it as it is shown above into standard assets/scripts or does it need to be in it's own folder in standard assets/scripts. Does this script provide a drawing and editing facility or does some version of Easy Roads (not V 3) also need to be installed 

This script I stopped using.  I am attempting to learn the method DPRoberts describes using blender.  Seems to be much better, here is his video.

https://www.youtube....h?v=rq1uS_XTZRs



#24 Stingreye

Stingreye

    Advanced Member

  • Members
  • PipPipPip
  • 341 posts
  • LocationSouthern California

Posted 02 April 2019 - 02:38 AM

How do you implement this script. Do you place it as it is shown above into standard assets/scripts or does it need to be in it's own folder in standard assets/scripts. Does this script provide a drawing and editing facility or does some version of Easy Roads (not V 3) also need to be installed ?

OK I went back and verified.  IN your assets folder there will be amn EasyRoads3D Folder then inside that the editor:

 

so Project/Assets/EasyRoads3D/Editor/

The script is called ERAPIEditor.cs

 

It will add a new menu option on the top menu bar in unity.  Let me know if you have any trouble.



#25 clubcaptain

clubcaptain

    Advanced Member

  • Members
  • PipPipPip
  • 1,310 posts

Posted 02 April 2019 - 11:13 AM

Presumably that's the free edition ?


PC specs...

Intel core I7 9700k 3.6 GHZ-Turbo 4.9 GHZ
64 GB Corsair vengeance  LPX DDR4 2400 MHZ
Asus PRIME Z390-P 
Nvidea GeForce RTX 2060 6GB
X box 360 wired controller
Windows 10 PRO NA 64 bit


#26 Stingreye

Stingreye

    Advanced Member

  • Members
  • PipPipPip
  • 341 posts
  • LocationSouthern California

Posted 02 April 2019 - 01:55 PM

Presumably that's the free edition ?

I was using the professional version. I have no idea if it works with the free one.

#27 clubcaptain

clubcaptain

    Advanced Member

  • Members
  • PipPipPip
  • 1,310 posts

Posted 02 April 2019 - 02:40 PM

I thought that V3 wasn't available for our version of Unity. You're saying the current version of EasyRoads 3D Pro  works fine with 5.2.3


PC specs...

Intel core I7 9700k 3.6 GHZ-Turbo 4.9 GHZ
64 GB Corsair vengeance  LPX DDR4 2400 MHZ
Asus PRIME Z390-P 
Nvidea GeForce RTX 2060 6GB
X box 360 wired controller
Windows 10 PRO NA 64 bit


#28 Stingreye

Stingreye

    Advanced Member

  • Members
  • PipPipPip
  • 341 posts
  • LocationSouthern California

Posted 02 April 2019 - 02:50 PM

Shoot me a PM. I kept the install file for version 3.0 which works with our version of unity. You still need the license code from easy roads fornit to work. Version 3.0 works with our version of unity. Also, I think if you extract the DLL’s from the newer version you can upgrade it to a newer version too.

#29 jt83

jt83

    Advanced Member

  • Members
  • PipPipPip
  • 1,023 posts

Posted 26 November 2019 - 03:59 AM

Looks like Easy Roads Pro 3 is on sale.  Does the Free version + DPRoberts method still satisfy all needs?  I really only want to draw very long roads without doing them in sections (Mike advises that in his tutorial), and connect roads/build a sealed racetrack.



#30 jt83

jt83

    Advanced Member

  • Members
  • PipPipPip
  • 1,023 posts

Posted 31 January 2020 - 03:08 AM

How time flies...anyway is the free EasyRoads now unattainable for our Unity?



#31 jt83

jt83

    Advanced Member

  • Members
  • PipPipPip
  • 1,023 posts

Posted 04 February 2020 - 12:39 PM

As it happens if you've imported the right EasyRoads once it gets saved in the AppData folder.



#32 RobC

RobC

    Advanced Member

  • Members
  • PipPipPip
  • 782 posts
  • LocationSouthampton England

Posted 04 February 2020 - 05:15 PM

I am still using easyroads from the unity store I just re-download it to each new project....I dont seem to have any trouble I then transfer them into blender ,thicken and join them

Only problem I have is you cant compile with it in your assets folder but you never could anyway



#33 jt83

jt83

    Advanced Member

  • Members
  • PipPipPip
  • 1,023 posts

Posted 05 February 2020 - 12:32 AM

Did you try recently?  In the Store the Free version shows as being 5.6.4 compatible only and the Add button wasn't clickable.

 

I was thinking about the Blender method but I played one of the original courses, Southampton, and saw that Mike or Andrew just laid down flat roads and linked them with a concrete texture...not as impressive as you guys but if it's good enough for them it's good enough for me  :D   No clubhouse either!



#34 RobC

RobC

    Advanced Member

  • Members
  • PipPipPip
  • 782 posts
  • LocationSouthampton England

Posted 05 February 2020 - 07:53 AM

Yep arcadia Bluffs... At work at the moment but I can check the version when I get home tonight if you want

#35 Justin9926

Justin9926

    Advanced Member

  • Members
  • PipPipPip
  • 760 posts

Posted 05 February 2020 - 03:27 PM

EasyRoads3D Free.unitypackage 


  • RobC likes this

Asus ROG G751JT-CH71 Gaming Laptop

2.5 GHz Intel Core i7– 4710HQ

Nvidia GTX 970M 3GB GDDR5

16 GB DDR3

Windows 10 64-bit





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users