The functionality of the makePerspective method in three.js has undergone modifications or has been eliminated

In a previous version of threejs, there was a method for setting the camera projection like this:

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

However, I am now encountering an error:

Error: has no method 'makePerspective' 

I am wondering what this method has been replaced with and how I should now call it.

Although the documentation still mentions this method, I have found it in

THREE.Matrix4.prototype.makePerspective
, but calling it from there does not work as expected.

Answer №1

When attempting to call a prototype method as if it were a static method, ensure that it is being called on a Matrix4 instance. For example:

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Implementing position sticky on a div depending on its content text - step by step guide

If the text inside the .newsDate matches the previous or next .newsDate, I want to make its position sticky when scrolling, until it reaches the next .newsMiddleCont div. What I'm trying to achieve: The same date on multiple news items should s ...

What is the reason behind the lack of access for modal to an external controller?

Imagine having this code in your main HTML file: <body ng-app="app" ng-controller="session as vmSession"> ... <!-- Modal content goes here --> </body> Inside the modal, you have a link: <a ui-sref="siteManagement({ site: vmSession.u ...

Retrieving value from the parent scope using the conventional approach

Today I was puzzled by some unexpected behavior of AngularJS. While using console.log to log $scope, I noticed that there was no key attached to the scope named val1. However, when I used console.log($scope.val1), it returned a value as an object. After ...

How can I alter the icon's color?

Is it possible for the icon's color to change to red when the condition is greater than 0, and to gray when the condition is equal to zero? <TouchableOpacity onPress={() => { if (Object.values(selectedIt ...

DiscordJS | Duplicate embed message in a different conversation

Recently, I set up a synchronization between a form and a Discord webhook. Within the webhook, there are three reactions automatically generated by an external BOT. My goal is to configure it so that when a reaction is selected, a confirmation prompt appea ...

javascript varying functionality between Chrome and Firefox

My Grease monkey script/Tamper monkey is designed to click on buttons that contain the word 'attach'. Although it works perfectly, I have noticed a difference in behavior between Chrome and Firefox. In Firefox, the clicks occur in the order of a ...

Issue with a variable within an *.ejs file

Currently, I am following a guide found at this link, and everything is working smoothly except when I encounter an error on the login screen: ..... 7| >> 8| <% if (message != null) { %> 9| <%= message %> 10| <% } %> 11| message ...

THIRD: the way to obtain a shape that resembles CylinderGeometry, except with a flat top surface instead of a circular one

Interested in learning more about Three.js? I have a question regarding obtaining an object that is similar to CylinderGeometry, but with one side as a different shape such as an ellipse, rectangle, or any closed shape... It's akin to the Loft comman ...

Extract information from an external HTML table and store it in an array

I am looking for a way to extract data from an HTML table on an external site and save it as a JSON file for further manipulation. Is there a method to retrieve table data from an external HTML site that differs from the code example provided? Additional ...

Employ the responseText property of $.ajax() to assign the data to a variable in JavaScript

Despite encountering numerous questions related to my issue, I have been unable to find a suitable answer. In an external JS file, I need the value of a session variable (view_mode) which can be either "complex" or "simple". My goal is to determine which ...

How can I replace specific text with HTML code in a webpage?

In my application, users have the ability to write comments that may contain HTML code. However, this code is escaped before being displayed: <div class="card-body"> <p class="card-text"> &lt;h1&gt;HOLA&lt;/h1&gt; Cita:#2&am ...

Differences between Angular 4 and AngularJs directives

Delving into the world of Angular 4, I have encountered a slight hurdle in my understanding of directives. My goal is to create a directive that can resize an element based on its width. Back in the days of AngularJs, this task was accomplished with code r ...

Employ moment.js to transform days into months and display the remaining days

Can anyone help me figure out how to convert 250 days into months and days using moment.js? Example: Given: 250 Days Desired Outcome: 8 Months and 7 Days ...

Dynamic loading of JavaScript/HTML content using jQuery Mobile and PhoneGap

I am currently in the process of building a mobile app using Dreamweaver CS6 (with PhoneGap), along with jQuery Mobile and JavaScript. This app aims to gather user-inputted form data, convert it into a JSON object, and send it to a python web service. The ...

What is the reason for not being able to retrieve query parameters in "getStaticProps"?

Let's simplify things: URL: http://localhost:3000/product/bioCloths?activeCategory=medium&id=0 File location: pages/product/[product].js. Expected output: product: "bioCloths, activeCategory: "medium", id: "0" using g ...

CSS changes triggered by JQuery are ineffective

Having trouble modifying the CSS of a class in my HTML file. I've been struggling with this for quite some time and can't figure out what I'm doing wrong. (I've already attempted multiple versions, but nothing seems to work) Here' ...

Firefox does not support the event

// This function makes rows draggable within a table by utilizing mouse events. // It handles the drag initiation, movement, and stopping of the drag operation. makeRowsDraggable: function() { var dragInitiated = false; var startPageX, startPageY ...

Modifying the functionality of the WebGl Screen-Space Projected Lines shader when zooming in and out

Currently, I am working on creating a 2D Graph structure using Three.js. However, I have encountered an issue regarding the behavior of Screen-Space Projected Lines when the camera zooms in and out. The problem is that the lines become much smaller when zo ...

Transferring information between different collections in MongoDB using Mongoose can lead to encountering a VersionError

I'm facing an issue where Mongoose is unable to find a matching document with the id when transferring data from one collection to another. On my website, users search for classes in a Mongo DB collection called "classes." Once they find a class succ ...

HTML structure consisting of a 3 by 3 grid

Creating a 3x3 grid with cells that have varying heights depending on content is proving to be challenging. Except for the cells marked with red arrows, the rest of the grid has fixed height in pixels. I attempted to build a 3x3 grid using divs to experi ...