Quad Mapping Issues

      public void quadBOX(Vector3f loc) {

     
     
       // 创建一个蓝色四边形
        Quad quad =new Quad(mapGrid3D.getCellsize(),mapGrid3D.getCellsize());
        Geometry quadBoxGeometry = new Geometry("quad", quad);

        // 创建一个蓝色材质
        Material boxMaterial1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        boxMaterial1.setColor("Color", ColorRGBA.Blue);
        boxMaterial1.getAdditionalRenderState().setWireframe(true);
        quadBoxGeometry.setMaterial(boxMaterial1);
        quadBoxGeometry.setLocalTranslation(loc);
       quadBoxGeometry.setLocalRotation(new Quaternion(-1,0,0,1));
        // 将盒子添加到场景中
        simpleApp.getRootNode().attachChild(quadBoxGeometry);
    }

loc=(0,0,0)

By default Quad Z axis is drawn down negative by default is that what JME expects?

What should I do if by default I want the Quad Z-axis to plot upward in positive numbers?

Do not construct Quaternions this way.

What is your intent here?

2 Likes

image

I rotated the Quad so that the front of the Quad was facing the camera because of the reverse culling that would occur.

Do you have a better suggestion?

Editor:

I deleted the spinning code and tried it and I seem to have found the problem.

Do you have a better suggestion?How should I use spin properly?

The values to the quaternion constructor are not human-readable values. They are magic 4D spherical coordinates.

To rotate a quaternion use on of the methods meant for create a particular rotation.

For example:
new Quaternion().fromAngles(FastMath.HALF_PI, 0, 0);

…and if that turns out to be upside down the flip the sign.

Quad is in x/y space… so it has to be rotated around the x-axis to get it into x/z space.

2 Likes