jPCT-AE - a 3d engine for Android > Support

Draw ground level grid

(1/3) > >>

AugTech:
Hi.
I am trying to draw a basic grid of 100m size tiles at floor/ ground level within my scene (think '80s Tron!)
I thought the new Polyline() class would be idea for this but it doesn't get rendered at all. :) Would Polyline be the right choice for this, or should I be creating something with Plane() ? Incidentally I want to be able to switch it on and off, but I can't see a method for removing/ changing the visibility of poylines on World().

--- Code: --- public static Polyline testPolyLine(SimpleVector origin) {
SimpleVector o = origin;

SimpleVector[] points = new SimpleVector[4];
points[0] = new SimpleVector(o.x,o.y,o.z-100);
points[1] = new SimpleVector(o.x,o.y,o.z+100);
points[2] = new SimpleVector(o.x,o.y-100,o.z);
points[3] = new SimpleVector(o.x,o.y+100,o.z);

return new Polyline(points, new RGBColor(130, 130, 130));

}

--- End code ---
And at start-up (when a position is known)

--- Code: ---getRenderer().getTheWorld().addPolyline( Utilities.testPolyLine( gridOrigin ) );

--- End code ---

As a note; the java doc doesn't include the Polyline() class...

Many thanks in advance.

EgonOlsen:
The javadoc does include Polyline. I've just checked the version in the distribution as well as the online version and both of them include it...!? Regarding visibility, just use the latest beta from here: http://jpct.de/download/beta/jpct_ae.jar. It adds the missing visibility feature.

I'm not sure why you don't see the Polyline...make sure that your camera has a location and direction that actually looks at the line and keep in mind that the Polyline will be affected the depth buffer, i.e. if your lines lie within your level's geometry, you are not going to see them.

AugTech:
Thanks Egon.
Sorry about the Javadoc - I was looking at the desktop version!

Have now sorted (as a test) as the origin was completely wrong for the scene.

Cheers.

AugTech:
This maybe more of a maths question (not my best subject!) but, given I can't use the same functions on a Polyline() as an Object3D, I thought I would still post the query...

I have direction and up vectors from my camera position which I usually supply to Object3D to ensure the objects are aligned correctly with my scene;


--- Code: ---SimpleVector dir = new SimpleVector(
camera.frontX,
camera.frontY,
camera.frontZ
);
SimpleVector up = new SimpleVector(
camera.upX,
camera.upY,
camera.upZ);

obj.setOrientation(dir, up);

--- End code ---

but Polyline() doesn't have the setOrientation() method. Can anyone suggest how I use these vectors with the polyline coordinates (points) to rotate the line?
Thanks in advance

EgonOlsen:
Does this happen at setup- or at runtime?

Navigation

[0] Message Index

[#] Next page

Go to full version