Jump to content
  • Advertisement
Sign in to follow this  
smacker

first person mesh placment

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

im creating a 3D first person networked game, my problem is how do I get the meshes to face the same direction as the camera, as in if im in the game and there is another player in and there moving forward how do I make sure that the mesh that represents them is facing the right direction. im using C# and directX 9 april update...

Share this post


Link to post
Share on other sites
Advertisement
Smacker,

You can store the angle about the vertical axis which they are facing. That is, if I'm using a left-handed coordinate system and my character is facing down the world Z axis (90deg about Y) and I rotate to my left, I'm now facing, lets say, 45 degrees left of the z-axis(135deg about Y).

You can build a rotation matrix from the Euler angle. You can then use this rotation matrix to transform the character into his rotated position. Keep in mind that this rotation needs to be performed in local space, not world space. So remember to transform the model before putting him in world space.

Cheers and good luck!

Share this post


Link to post
Share on other sites
now seeing that im sending the clients camera lookat position, and the camera eye location, couldent I just use the cameras lookat position vector3?

and also how do I go about seting the rotation before the world transform

right now im using

dev.Transform.World = Matrix.Transformation(ect...);

Share this post


Link to post
Share on other sites
also what rotation matrix would I use the objects that im moving are space ships, so I was using RotationYawPitchRoll but this is not working here is what I have done

ma.Transform(new Vector3(), Quaternion.Identity, new Vector3(.3f,.3f,.3f), new Vector3(), Quaternion.RotationMatrix(Matrix.RotationYawPitchRoll(d_point.Y, d_point.X, 0.0f)) ,b_point);

then place it in the world

Device.Transform.World = ma;
then I draw the mesh...

Share this post


Link to post
Share on other sites
Use the inverse of your view transform. In the other player's view, the entire world is moved to be in his own coordinate system. In this player, the other player needs to be move. So seems to me it's the inverse of the transform.

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.

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!