Jump to content
  • Advertisement
Sign in to follow this  

XMVECTOR and XMVectorSet

This topic is 2113 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, Have some few questions that are probably stupid questions.

Am trying to set the rotaxis to All zero so that my BasicCubeSecond Doesnt get a rotation at all. But everytime I try to do it I get some wierd error in the XNA source file, complaining about

> FusionEmpty.exe!XMAssert(const char * pExpression, const char * pFileName, unsigned int LineNumber) Line 1865 C++
And something about the program reaching a breakpoint (__debugbreak()) which I have no idea why.

Is my way to do it wrong?

[source lang="cpp"]
void UpdateScene()
rot += .0005f;
if(rot > 6.28)
rot = 0.0f;

//Reset Cube rotation

BasicCube = XMMatrixIdentity();
XMVECTOR rotaxis = XMVectorSet(0.0f,1.0f,0.0f,0.0f);
WorldRotation = XMMatrixRotationAxis(rotaxis,rot);
WorldTranslation = XMMatrixTranslation(0.0f,0.0f,4.0f);

//Set cube1's world space using the transformations
BasicCube = WorldTranslation * WorldRotation;

//Reset Cube 2

BasicCubeSecond = XMMatrixIdentity();
rotaxis = XMVectorSet(0.0f,0,0.0f,0.0f); //<------------------ Trying to set the rotation to 0
WorldRotation = XMMatrixRotationAxis(rotaxis, rot);
WorldScale = XMMatrixScaling(1.3f,1.3f,1.3f);
//Set Cube 2
BasicCubeSecond = WorldRotation * WorldScale;

Share this post

Link to post
Share on other sites
Are you sure it is XMVectorSet line, not the XMMatrixRotationAxis one? Because if you look at the source of XMMatrixRotationAxis you'll see following code:
#if defined(_XM_NO_INTRINSICS_)
XMASSERT(!XMVector3Equal(Axis, XMVectorZero()));
Normal = XMVector3Normalize(Axis);
M = XMMatrixRotationNormal(Normal, Angle);
return M;
#elif defined(_XM_SSE_INTRINSICS_)
XMASSERT(!XMVector3Equal(Axis, XMVectorZero()));
XMVECTOR Normal = XMVector3Normalize(Axis);
XMMATRIX M = XMMatrixRotationNormal(Normal, Angle);
return M;
#else // _XM_VMX128_INTRINSICS_
#endif // _XM_VMX128_INTRINSICS_

Basically it will assert if rotaxis equals to zero vector.

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!