java LibGDX 3DSphere在使用鼠标在屏幕上移动时正在更改形状
我使用libGDX在modelBuilder上调用createSphere()方法,使用纹理创建了一个球体。因为它是3D的,所以我用了透视相机。我正试图用鼠标移动屏幕上的球体。它工作正常,但球体在屏幕上移动时一直在改变形状
我试着改变透视相机的位置和视角。尽管如此,形状正在改变。有人能提出解决办法吗
以下是我的代码部分:
modelBatch = new ModelBatch();
ModelBuilder modelBuilder = new ModelBuilder();
Texture texture = new Texture(Gdx.files.internal("ball.png"));
Material material = new
Material(TextureAttribute.createDiffuse(texture));
final long attributes = VertexAttributes.Usage.Position |
VertexAttributes.Usage.TextureCoordinates;
sphere = modelBuilder.createSphere(0.5f, 0.5f, 0.5f, 24, 24, material, attributes);
sphereInstance = new ModelInstance(sphere);
perCamera = new PerspectiveCamera(67, Gdx.graphics.getWidth(),
Gdx.graphics.getHeight());
perCamera.position.set(0f, 0f, 3f);
perCamera.lookAt(0f,0f,0f);
perCamera.near = 1f;
perCamera.far = 300f;
perCamera.update();
[Here I have attached screenshot for the reference, in which the regular sphere changes its shape to ellipse as it is moving away from the camera.][1]
共 (0) 个答案