Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi everyone,
Is there a way to get pixel coordinates of those points on 2D canvas?
In the end I wanted to get a list of pixel coordinates for those 4 points, that will represent where those points will be located on final render.
I tried to find corresponding function in API Doc, but no luck unfortunately.
Would be awesome to know the answer! Have a great day everyone!
@constantine_sazonov You will want to use
BaseView.WS(self, p)
Converts p from world space to screen space (pixels relative to the view)
Or maybe better: Camera to screen conversion
BaseView.CS(self, p, z_inverse)
@c4ds Oh, wow, thank you so much!
Hello @constantine_sazonov,
thank you for reaching out to us. And thank you again @C4DS for providing an answer. The conversion methods to convert between different coordinate systems are attached to c4d.BaseView as demonstrated by @C4DS. Depending on the concrete implementation, you might have to take care of safe frames though, since screen space does not imply them, but is simply all visible area of the view, i.e., the view frame.
c4d.BaseView
There has been this topic in the past which was similar in nature where I also did provide some code.
Cheers, Ferdinand
@ferdinand Thank you very much for the info!