Skip to content

[Feature Request] Expose 2D positions of objects #90

Answered by marcofugaro
kWh61 asked this question in Q&A
Discussion options

You must be logged in to vote

You can convert the 3D coordinates of the object to 2D coordinates by using the camera, you can do it like this:

const obj = spline.findObjectByName(event.target.name);
const camera = spline.findObjectByName('Camera'); // or the name of the camera you're using
const { x, y } = toScreenPosition(obj, camera);

You can get the code of the toScreenPosition() function from this stackoverflow answer.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kWh61
Comment options

@marcofugaro
Comment options

@Naresh-Khatri
Comment options

Answer selected by kWh61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #89 on November 10, 2022 10:13.