Author Topic: About Alien Runner's roads Object3D planes  (Read 2603 times)

Offline mxar

  • int
  • **
  • Posts: 78
    • View Profile
About Alien Runner's roads Object3D planes
« on: February 01, 2017, 10:49:25 pm »
Hi.

The Alien Runner game uses a straight road which is based on Object3d planes.

In case  a developer needs to create a similar game with curved roads what the solution will be?

I'm trying to develop a method which creates a curved road.

The method will be something like this:

Object3D curvedPlane = createCurvedPlane(float innerRadius,float ouRadius,float angle,int quads)

This method is like the ExtendedPrimitives.createTube(float innerRadius, float outerRadius, float height, int quads)
but the height is equal to zero and the tube is not round but is drawn arount to an angle < 360 degrees.

Any idea to help me?

Thanks in Advance.
Modify message

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: About Alien Runner's roads Object3D planes
« Reply #1 on: February 01, 2017, 11:06:54 pm »
The simplest idea that comes to my mind of to create a straight road out of x road parts and then rotate the vertices of all parts around the lower right (or left) vertex of the first part by some angle. Do that for all vertices of all parts that come after the part in question and then repeat the process with the next part. No idea of that would actually work, but it might.
It might be better to do that on your coordinates and create an object from the results instead of doing it on an actual object.

Offline mxar

  • int
  • **
  • Posts: 78
    • View Profile
Re: About Alien Runner's roads Object3D planes
« Reply #2 on: February 02, 2017, 09:42:10 am »
Thanks for the reply.

I'll check this solution.

How can I do the vertices rotation?


I had in mind to create a racing track defined as a list of segments: straights and left/right turns like in the attached image.

The straight part will be the Object3D plane and the left/right plane is the Object3D I try to create with the

Object3D curvedPlane = createCurvedPlane(float innerRadius,float ouRadius,float angle,int quads) methods.



 




Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: About Alien Runner's roads Object3D planes
« Reply #3 on: February 05, 2017, 08:15:18 pm »
You can rotate them by applying some basic rotation math to them...