About Alien Runner's roads Object3D planes

Started by mxar, February 01, 2017, 10:49:25 PM

Previous topic - Next topic

mxar

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

EgonOlsen

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.

mxar

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.








EgonOlsen

You can rotate them by applying some basic rotation math to them...