Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

XMVECTOR and XMVectorSet


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Conny14156   Members   -  Reputation: 190

Like
0Likes
Like

Posted 05 December 2012 - 05:36 PM

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 rotationBasicCube = 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 transformationsBasicCube = WorldTranslation * WorldRotation;//Reset Cube 2BasicCubeSecond = XMMatrixIdentity();rotaxis = XMVectorSet(0.0f,0,0.0f,0.0f); //<------------------ Trying to set the rotation to 0WorldRotation = XMMatrixRotationAxis(rotaxis, rot);WorldScale = XMMatrixScaling(1.3f,1.3f,1.3f);//Set Cube 2BasicCubeSecond = WorldRotation * WorldScale;}[/source]

Ad:

#2 Martins Mozeiko   Members   -  Reputation: 1149

Like
0Likes
Like

Posted 05 December 2012 - 06:02 PM

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:
XMINLINE XMMATRIX XMMatrixRotationAxis
(
    FXMVECTOR Axis,
    FLOAT    Angle
)
{
#if defined(_XM_NO_INTRINSICS_)
    XMVECTOR Normal;
    XMMATRIX M;
    XMASSERT(!XMVector3Equal(Axis, XMVectorZero()));
    XMASSERT(!XMVector3IsInfinite(Axis));
    Normal = XMVector3Normalize(Axis);
    M = XMMatrixRotationNormal(Normal, Angle);
    return M;
#elif defined(_XM_SSE_INTRINSICS_)
    XMASSERT(!XMVector3Equal(Axis, XMVectorZero()));
    XMASSERT(!XMVector3IsInfinite(Axis));
    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.

#3 Conny14156   Members   -  Reputation: 190

Like
0Likes
Like

Posted 06 December 2012 - 04:24 PM

Yeha thanks, seems like it was stupid of me setting rotaxis to all zero >.< thank you




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS