• Advertisement
Sign in to follow this  

Changing y and z coordinates in a vector?

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

ok I have this function (bulletHit) and I want to change all the y and z coordinates of Vector3D *vertexList (Which holds the world vertices loaded from a raw file). Below is how I am trying to change them. Doesnt seem to work at all. Can I actually do this?? Hope this makes sense. Vector3D bulletHit(Vector3D *vertexList, int totalVert, Vector3D bulletStart, Vector3D bulletDirection) { for(int j = 0; j < totalVert; j++) { float fTempY = vertexList[ j ].y; vertexList[ j ].y = vertexList[ j ].z; vertexList[ j ].z = -fTempY; } //REST OF THE FUNCTION

Share this post


Link to post
Share on other sites
Advertisement
If you're trying to just swap the z and y components, negating the new z component at the same time, then yes. If you're not, then your code isn't doing what you want. What exactly do you need to do?

Share this post


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

  • Advertisement