Jump to content
  • Advertisement
Sign in to follow this  
matthew135

streaming inputs and updating View Matrix

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

Hi there, I don't know if i'm explaining this correctly, but what I want to do is the following: I have a camera that I connect via serial and it outputs real-time streaming coordinates such as x y and z coordinates of where the object is that it is tracking. I have created a 3D environment using Direct X that enables me to move the camera around and view the environment from different angles etc. I believe this is called "First person shooter" type of application. Is there some way to feed the View Matrix streaming x y and z coordinates that are being fed to me via serial connection? A friend of mine has created a program in VB that is able to obtain the serial coordinates and save the to a text file. Could I for example, read these coordinates from the text file and use them to update my view matrix? I'm not sure if this would work? Perhaps I could create some type of Array in which these streaming x y z coordinates are saved and read and then used to update my View Matrix. Does anyone have any idea how I might go about something like this? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
How exactly do you want to update the View Matrix? Do you want the (Direct3D) camera to always be looking directly at the object? Or is it that you want the object to move in the simulation world?

Either is very easy to do, you would just have to let us know exactly which API and language you're using to get the specifics.

Share this post


Link to post
Share on other sites
I want the camera to always be looking at the object. I want the View Matrix to be updated via a dynamic array that is fed x y and z coordinates via serial. Would you know how to go about doing this? Thanks.

Share this post


Link to post
Share on other sites
You'll want to create a new view matrix using a lookAt point. Basically you just specify the position of the camera, the point you want it to look at (which you'd get from your stream of coordinates), and an up vector (which you can just set to <0,1,0>). In native D3DX the function is D3DXMatrixLookAtLH, and in XNA the method is Matrix.CreateLookAt (I'd image this is similar to what's in MDX or SlimDX).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!