Project vector into camera


#1

Hello! in three.js exist a function calls Projects (onto a camera):

.project ( camera : Camera ) : this

camera — camera to use in the projection.

project: function ( camera ) {

		return this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );

	},

Projects the vector with the camera.

anybody know the maths to do something similar in ofx? im new here, thanks!


#2

if you are using an ofCamera or ofEasyCam you can use the methods worldToScreen and screenToWorld to get the projection or revert the projection to world coordinates respectively.

If you want to do it with any matrix you can use glm::project and glm::unproject