Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Get a 3D Vector from Box Object in P3D

$
0
0

Hello All,

I'm wondering if there's an easy way to get a 3D (or 2D) vector from a box(); or sphere(); object in processing?

I won't post my code, bc it is ENORMOUS, but basically I've placed a box relative to a text in 3D space, and eventually I want to position a proscene camera where the box is, but to position the camera, I need a 3D vector.

Here's some code around how I got my box where I want it:

    pushMatrix();
    translate(convertedTweetCoordiante.x()-textWidth(sign_text)/2, convertedTweetCoordiante.y(), sign_height);
    rotateX(radians(-90));
    translate(textWidth(sign_text)/2, 0, 0);
    rotateY(radians(sign_rot));

    translate(0, 0, 200);
    box(20);
    translate(0, 0, -200);

    translate(-textWidth(sign_text)/2, 0, 0);
    translate(-convertedTweetCoordiante.x(), -convertedTweetCoordiante.y(), -sign_height);
    translate(0, 0, sign_height);
    println(sign_height);
    text(sign_text, convertedTweetCoordiante.x(), convertedTweetCoordiante.y(), 200, 200); //xy
    translate(0, 0, -sign_height);
    popMatrix();

Here's where I need to put in my 3D vector to get the camera to the right position:

    scene.camera().setPosition(convertedTweetCoordiante.x(), convertedTweetCoordiante.y()+200, sign_height);

Thank you for any insight you can provide.


Viewing all articles
Browse latest Browse all 2896

Trending Articles