We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Object Screen size

Home Forums General Questions Object Screen size

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #80814
    David Duperron
    Customer

    Hi!
    Is there a way to get an object screen size (in pixels : x/y)? I need this to adjust my HTML interface to the size of some objects in my scene…
    Thanks for the help!

    David

    #80816
    kdv
    Participant

    Google has banned you? B-)
    https://stackoverflow.com/questions/15331358/three-js-get-object-size-with-respect-to-camera-and-object-position-on-screen

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #80817
    David Duperron
    Customer

    Nope… not yet… :-) I found this one but I also forgot to mention that it’s in the case of an orthographic camera…

    #80818

    Hi,

    you might use something like that:

    the code in puzzle:

    const objHeight = 1.5;
    const height = objHeight / 2 * app.camera.zoom * app.getHeight();
    console.log(height);

    Soft8Soft Tech Chief
    X | FB | LinkedIn

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.