Sign in to follow this  

Usage of Vector3.Project ??????

This topic is 4779 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

Here is a sample of what we tried: 1) we draw a ball at position (0,0,-200) 2) we used the code snippet below to draw a line starting at position (0,0,-200) [ball position]. To do so, we used the Vector3.Project() passing the (0,0,-200) value to get a coordinate in screen space so as to feed the Direct3D.Line()) --> The rendered line does not (AT ALL) start at the ball position.... We are lost ... and the MS documentation, on this subject, is by far the worste we have seen so far. Thanks for any help, José Code snippet: -------------- translationX = 0.0f; translationY = 0.0f; translationZ = -200.0f; UpdateTranslationAndRotation(); // Update the Device.Transform.World equalizerlightTest.Render(device, true, false); // Render mesh in the 3D environment // Get the 2D represention Vector3 v3D = new Vector3(translationX, translationY, translationZ); v3D .Project(device.Viewport, device.Transform.Projection, device.Transform.View, device.Transform.World); // Draw a line (using Direct3D.Line) Vector2[] v = new Vector2[2]{new Vector2(v3D .X, v3D .Y), new Vector2(v3D .X + 300, v3D .Y+ 300)}; _lin.Begin(); _lin.Draw(v, Color.Red); _lin.End();

Share this post


Link to post
Share on other sites
Why are you adding 300 to the resulting x,y positions?

edit - nevermind. I see what you're doing.

Have you tried using DrawTransform()? That way,you can specify the line in 3D coordinates. It might be easier to get the results you want.


[Edited by - Dave Hunt on November 15, 2004 1:32:01 PM]

Share this post


Link to post
Share on other sites

This topic is 4779 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this