Jump to content
  • Advertisement
Sign in to follow this  

XMVECTOR and XMVectorSet

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!