Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript React Three.js使场景中的对象更大,类似于画布大小_Javascript_Reactjs_Animation_Three.js - Fatal编程技术网

Javascript React Three.js使场景中的对象更大,类似于画布大小

Javascript React Three.js使场景中的对象更大,类似于画布大小,javascript,reactjs,animation,three.js,Javascript,Reactjs,Animation,Three.js,上图中的画布很大,但场景很小。如何使场景或场景中的3D对象更大,并且可能与画布的高度和宽度相匹配 代码: import React,{Component}来自'React'; 从“react three渲染器”导入React3; 从“三”中导入*作为三; 类Graph3D扩展组件{ 构造函数(道具、上下文){ 超级(道具、背景); this.cameraPosition=新的3.Vector3(0,0,5); 此.state={ 原点:新三,矢量3(0,0,0), 向量1:新的三个向量3(0,0

上图中的
画布
很大,但
场景
很小。如何使
场景
场景
中的3D对象更大,并且可能与
画布
的高度和宽度相匹配

代码:

import React,{Component}来自'React';
从“react three渲染器”导入React3;
从“三”中导入*作为三;
类Graph3D扩展组件{
构造函数(道具、上下文){
超级(道具、背景);
this.cameraPosition=新的3.Vector3(0,0,5);
此.state={
原点:新三,矢量3(0,0,0),
向量1:新的三个向量3(0,0.5,0.5),
矢量2:新的三个矢量3(0.2,0.3,0.1),
向量3:新的三个向量3(0.2,0.4,0.1),
向量4:新的三个向量3(0.6,0.8,0),
矢量5:新的三个矢量3(0.9,0.9,0.9),
矢量6:新的三个矢量3(0.2,0.8,0.9),
};
}
render(){
const width=window.innerWidth;//画布宽度
const height=window.innerHeight;//画布高度
返回(
);
}
}
使用
画布上方的此代码
可以获得
屏幕的大小
,但由于某些原因,所有的
箭头帮助程序
和我的
场景
相比都很小

我怎么把它们弄大


我尝试为我的
向量指定更大的值,但没有帮助。

尝试将相机移近场景:

 this.cameraPosition = new THREE.Vector3(0, 0, 2);
也可以使箭头变长。分配较大值不起作用的原因是它们只是方向向量。
ArrowHelper
还有第三个可选参数,即箭头的长度:

<arrowHelper
    origin={this.state.origin}
    dir={this.state.vector3}
    length={2}
/>

谢谢,但它非常像素化。我如何防止这种情况?试图浏览文档,但是有这么多信息——我;我试着玩
fov
far
near
道具,但帮不了什么忙
<arrowHelper
    origin={this.state.origin}
    dir={this.state.vector3}
    length={2}
/>