简体   繁体   English

WebGL中的相同旋转

[英]same rotations in WebGL

I'd like to rotate a plane the same way as the camera rotates (that it looks like it doesn't move at all) 我想以与相机旋转相同的方式旋转平面(看起来好像根本不移动)

my animate() function for the camera: 我的相机的animate()函数:

camera.position.x = Math.sin(t/1500)*200;
    camera.position.y = 250;
    camera.position.z = Math.cos(t/1500)*200; 

And the plane (done with CubeGeometry): 和平面(使用CubeGeometry完成):

var plane = new THREE.Mesh(
    new THREE.CubeGeometry(100, 1, 50),
    new THREE.MeshBasicMaterial({color: 0xFF00FF}));
    plane.position.y = 115;
    plane.position.z = 25;

Which parameters does the plane need that it looks like standing still? 飞机需要看起来像静止不动的哪些参数?

Thanks :) 谢谢 :)

Hope that including the below code may help you. 希望包含以下代码可以对您有所帮助。 As the camera rotates, the plane will also rotate to look towards the camera. 随着相机旋转,飞机还将旋转以朝向相机。

plane.lookAt( camera.position ); plane.lookAt(camera.position);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM