简体   繁体   中英

threejs makePerspective method has been removed or changed

in an older version of threejs, you could do this:

camera.projectionMatrix = THREE.Matrix4.makePerspective( fov, aspect, 1, 1100 );

this is now throwing an error:

has no method 'makePerspective' 

What has this been replaced with and how do I call it?

The documentation still notes that this method exists, and I found it in THREE.Matrix4.prototype.makePerspective , but it doesn't work if I call it there.

You are trying to call a prototype method like a static one. It needs to be called on a Matrix4 instance. You could try:

camera.projectionMatrix = (new THREE.Matrix4()).makePerspective( fov, aspect, 1, 1100 );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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