Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Geometry problem

This topic is 5435 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''d like to draw an object which always face the camera. Because my english is not so good, i attached three shots of what i''d like to achieve. As you can see i''d like to render an object (also a simple quad, represented by the orange box) which has the position and orientation shown in the shots. Billboarding wouldn''t do, because i lose one axis. http://www.web-discovery.net/temp/1.jpg http://www.web-discovery.net/temp/2.jpg http://www.web-discovery.net/temp/3.jpg

Share this post

Link to post
Share on other sites
Rotate the quad about its local-z axis, so that its normal intersects the camera''s forward vector.


Share this post

Link to post
Share on other sites
a slightly longer explanation of this:

obviously one axis is already given be the orientation of the plane. for the quad to face the viewer as much as possible its normal has to intersect your view direction. sounds difficult to achieve but its simple. take the crossproduct between your given vector and the vector from quad to camera. now you have two out of three needed vectors. for the last one, do the crossproduct between those two. pretty much like billboarding.

Share this post

Link to post
Share on other sites
some old dx code flying around:
"forward" is the z axis here, meaning the direction the beam is going. "up" is the y axis, "right" is the x axis and the one supposed to face the camera. but which is which depends on how your quad is oriented in your case.

D3DXVec3Cross(&NewUp, &Delta, &Forward);
float length=D3DXVec3Length(&NewUp);
D3DXVec3Cross(&NewRight, &NewUp, &Forward);

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!