www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: jpro on December 01, 2010, 08:37:25 pm

Title: Merging Primitive planes
Post by: jpro on December 01, 2010, 08:37:25 pm
Is there any reason I shouldn't do:

Code: [Select]
Object3D plane1 = Primitives.getPlane(1, 10f);
Object3D plane2 = Primitives.getPlane(1, 10f);
plane2.rotateX((float) Math.toRadians(90));

Object3D merged = Object3D.mergeObjects(plane1, plane2);
world.addObject(merged);
world.buildAllObjects();

When I do so only one plane is visible.
Title: Re: Merging Primitive planes
Post by: Nick on December 01, 2010, 11:49:55 pm
Hey jpro,

Maybe the camera is set up so you're looking to a plane from behind or from the side. You must mention that when creating planes you can only display one side. I think this is the reason for your problem, so you could just try to rotate the other plane or the camera. Maybe that helps?
Title: Re: Merging Primitive planes
Post by: jpro on December 01, 2010, 11:56:17 pm
A decent guess, but it's not visible from any angle. Camera is in fly mode and I have checked it from below, above, left, right, etc.
Title: Re: Merging Primitive planes
Post by: EgonOlsen on December 02, 2010, 08:02:55 am
You are rotating via matrix transform only this way. Add a

Code: [Select]
plane2.rotateMesh();
plane2.clearRotation();

after the rotateX to make it permanent and see if that helps.
Title: Re: Merging Primitive planes
Post by: jpro on December 02, 2010, 04:23:26 pm
That worked. Thank you. :)
Title: Re: Merging Primitive planes
Post by: EgonOlsen on December 02, 2010, 04:34:21 pm
If you are doing this only to work around backface culling, then Object3D.setCulling(false); does the same thing without duplicating the geometry. If lighting is an issue, it might be useful to double the plane as you do though.