Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
spoinkh
spoinkh's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
3D Box
[2 Replies]
06-Jun-2012 09:55 AM
Forum:
Core Library Questions
First, sorry for my bad english!
I want to make a programm, where a 3D box is in the center of the screen and the box should "look" at my cursor.
My problem is that the box isn't looking on my cursor - can anybody help me?
Here's the short code:
import processing.opengl.*;
float alpha=0;
void setup() {
size(800, 480, OPENGL);
smooth();
}
void draw() {
background(0);
textSize(40);
stroke(125);
translate(width/2, height/2);
alpha = PI/width*mouseX;
rotateX(radians(20));
rotateZ(-alpha);
drawBox();
}
void drawBox() {
stroke(255, 0, 0);
line(-300, 0, 0, 0, 0, 0);
text("This line should touch my cursor", -330, 0, 0);
box(50);
}
Thank you for EVERY USEFUL ANSWER! :-)
«Prev
Next »
Moderate user : spoinkh
Forum