We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › rotating sprites in 3d
Page Index Toggle Pages: 1
rotating sprites in 3d (Read 583 times)
rotating sprites in 3d
Jun 15th, 2009, 10:07pm
 
Is there an easy way to rotate sprites/Images to always face the camera when used in 3d space? like in the good old doom for example...  ive got a moving sprite in a rotating space and i always want it to be visible.
Re: rotating sprites in 3d
Reply #1 - Jun 16th, 2009, 6:03am
 
Couple ways to do this... search for billboarding.  
It will likely look something like
Code:

pushMatrix();
translate(x, y, z);
rotateX(rotations[0]);
rotateY(rotations[1]);
rotateZ(rotations[2]);
image(picture, width/2, height/2);
popMatrix();


The other way is more complex (OpenGL) but good if you have a lot of images and need performance.  See http://processing.org/discourse/yabb2/num_1224365195.html

Shaders can do this as well.
Re: rotating sprites in 3d
Reply #2 - Jun 16th, 2009, 9:06am
 
thx. im getting an error using your link.
Re: rotating sprites in 3d
Reply #3 - Jun 16th, 2009, 9:50am
 
(that url has an extraneous %A0 at the end, just remove it)
Page Index Toggle Pages: 1