• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

788 Good

About Noxil

  • Rank

Personal Information

  • Interests
  1. Bullet - btGhostObject

    I think for now, im going to simply solve my problem by not allowing triggers to take action for the first frame they are alive. Sure... Not the best option, but atleast i can move forward for now. So to sum it up, i thought i had a problem with btGhostObject. It turned out to be a problem with teleporting objects instead. Thanks for all the help
  2. Bullet - btGhostObject

    Thanks for explaning. Tinkering with the code, i think im starting to understand what the actuall problem is... If i put a log inside the loop i get a hit the first frame, then i stop getting hits. So im thinking im doing something wrong when im trying to transform the btRigidBody. This is my naive approach btTransform world( btQuaternion(p_Rotation.yaw, p_Rotation.pitch, p_Rotation.roll), btVector3(p_Location.x, p_Location.y, p_Location.z) ); m_Body->setWorldTransform( world ); m_Body->getMotionState()->setWorldTransform( world );
  3. Bullet - btGhostObject

    Right now, im not doing anything. Is my understanding wrong here. Shouldnt i only get overlapping pairs when the AABBs intersect?
  4. Bullet - btGhostObject

    Yeah, all the informaiton i can find seem to say that im doing it right. But yet it yeilds strange results I read abit about the contact callback thing. But i felt hesitant towards it, since even Bullet says the preferred way is to use ghost objects. Guess i have to do some experiments with it and see what happens
  5. Bullet - btGhostObject

    Hello, I have googled and for quite some time now and i seem to only find the same type of answer. And the result im getting is so strange. The goal is to create a trigger volume (for now a box) that should trigger events whenever something enters it. According to the Bullet, btGhostObject is the way to go for simple triggers. This is my code for setting up bullet. m_BulletBroadphase = new btDbvtBroadphase(); m_BulletConfiguration = new btDefaultCollisionConfiguration(); m_BulletDispatcher = new btCollisionDispatcher( m_BulletConfiguration ); m_BulletSolver = new btSequentialImpulseConstraintSolver; m_BulletDynamicsWorld = new btDiscreteDynamicsWorld( m_BulletDispatcher, m_BulletBroadphase, m_BulletSolver, m_BulletConfiguration ); m_BulletDynamicsWorld->setGravity( btVector3(0.0f, -50.0f, 0.0f) ); m_BulletDynamicsWorld->getPairCache()->setInternalGhostPairCallback( new btGhostPairCallback() ); btGhostObject // create trigger volume btTransform world( btQuaternion(rotation.yaw, rotation.pitch, rotation.roll), btVector3(location.x, location.y, location.z) ); m_GhostObject = new btGhostObject(); m_GhostObject->setCollisionShape( new btBoxShape(btVector3(10.0f, 5.0f, 10.0f)) ); m_GhostObject->setWorldTransform( world ); getGameWorld()->getBulletDynamicWorld()->addCollisionObject( m_GhostObject ); .... // check for intersections btAlignedObjectArray< btCollisionObject * > & pairs = m_GhostObject->getOverlappingPairs(); for( pmInt32 i=0; i<pairs.size(); ++i ) { .... } And finally, the object that i use to test the trigger with btDefaultMotionState * motionState = new btDefaultMotionState(); btVector3 inertia; m_Shape = new btBoxShape(btVector3(5.0f, 5.0f, 5.0f)); m_Shape->calculateLocalInertia( m_Mass, inertia ); btRigidBody::btRigidBodyConstructionInfo rigidBodyCI( m_Mass, motionState, m_Shape, inertia ); m_Body = new btRigidBody( rigidBodyCI ); The simulation looks correct, the rigid body spawns highup in the air and falls down correctly. The btRigidBody is transformed to location(0.0f, 40.0f, 0.0f) And the trigger is transformed to location(0.0f, 5.0f, 0.0) The problem im getting is that in the triggers intersection check i instantly get a overlapping pair. Even though they are really far apart and their AABBs cant intersect. I also checked their worldTransforms, they indicate that they are positioned correctly. I went as far to even set the interpolatedWorldTransform but it dident help. Have anyone else had this problem or am i just missing something basic here?
  6. Oh my... I cant thank you enough! I finally found the problem! And you where so correct in your last statement, the SKIN! So the problem was a missunderstanding on my side on how to apply the skinning correctly in the shader. I have been fighting with this problem for so long now. There are so many places where things can go wrong, export, import, interpolations, rigs, heirarchies etc etc. What helped me the most was the fact that you posted images from your engine showing my mesh. Thank you so much!
  7. If that is your result then you get the same result as i do. My keyframe in maya it rotates to about 90 degree This is frame 30 for me. So im assuming i have done something really wrong in maya then! Edit: So hmm if it works for you, then yeah it must be the skin then i guess. Thank you for trying it out
  8. Thanks for pointing this out DonDickieD. These are my main matrix functions. Perhaps i have done something wrong here? void matrixCreateTransform( Matrix4v4 * p_Result, const Vec3f & p_Translation, const Vec3f & p_Scale, const Quaternion & p_Rotation ) { XMMATRIX translation = XMMatrixTranslation( p_Translation.x, p_Translation.y, p_Translation.z ); XMMATRIX scale = XMMatrixScaling( p_Scale.x, p_Scale.y, p_Scale.z ); XMMATRIX rotation = XMMatrixRotationQuaternion( makeVectorRegister(p_Rotation.axis.x, p_Rotation.axis.y, p_Rotation.axis.z, p_Rotation.amount) ); XMMATRIX m = XMMatrixMultiply( scale, rotation ); XMStoreFloat4x4A( (XMFLOAT4X4A *)p_Result, XMMatrixMultiply(m, translation) ); } void matrixMultiply( Matrix4v4 * p_Result, const Matrix4v4 * p_A, const Matrix4v4 * p_B ) { XMMATRIX a = XMLoadFloat4x4A( (const XMFLOAT4X4A *)p_A ); XMMATRIX b = XMLoadFloat4x4A( (const XMFLOAT4X4A *)p_B ); XMMATRIX r = XMMatrixMultiply( a, b ); XMStoreFloat4x4A( (XMFLOAT4X4A *)p_Result, r ); }
  9. So i have tried some euler to quaternion with no success. I get a another type of rotation, it dosnt rotate from the root bone any more but just slighly bends in the middle instead. It looks further away from the direction i should be heading if i compare to the quaternion rotation. But im not quite sure that i got it all right. I did the quaternion multiplications myself, aswell as to use the DX11 function "XMQuaternionRotationRollPitchYaw". They both gave the same result. It feels like the quaternion i get from "GetQ" using "boneNode->EvaluateLocalTransform(time)" is not the correct value or something. When i load the frames and extract the quaternion in my engine. If i multiply the w component with 2.0f the animation seems to rotate almost to the point where it should.
  10. Thank you both for your replies, i will make some tests regarding your posts. As per request from ongamex92 i have attached the maya file and fbx file. Edit: Reuploaded .mlt file, it hade unsaved changes (dont know what they where) anim_scene.fbx anim_test.mlt
  11. Okey so now im using the cluster in the same maner you are regarding the inverse bind pose. Also i now use the node from cluster->GetLink() to retreive the animation frame data. And the result is the same Rotation in frames is extracted like so: FbxAMatrix transform = boneNode->EvaluateLocalTransform( time ); frame->m_Rotation = transform.GetQ(); So i dont use GetR but instead GetQ. Is this a problem? It must be something super simple. Everything looks right but its just not rotating all the way so to say.. Edit: Also, i created a new mesh, new rig and new animation with less bones. Same problem. Are there some settings in Maya i need to be aware off maybe?
  12. Hey thanks for replying. Im assuming you get your cluster from the FbxMesh right? Do you know if there is a difference in going from the deformer instead of getting the node directly from the scene? What im wondering is if the deformer has other functions or properties that does something that the node does not. Also for the keyframes, do you use the child nodes from the deformer or how do you access them? In my exporter im looping through the scene nodes, find a skeleton type node then iterate over all its children. So what i can see right of the bat is that your are getting the bind pose from the deformer and im using the regular node. Might be something? I will have to do some tests when i get back home, thanks for sharing your example
  13. Hello, I have been fighting for sometime now with exporting animations from Maya to my own engine using DirectX 11. I export the fbx file with all its content in it. So the problem i have is that the animation dosnt seem to rotate the joints correctly? Please see the attached screenshots. bindpose.png = Frame 1 (first keyframe is at frame 2), the bindpose, no animation applied. frame30.png = Frame 30, rotation applied to two joints. engine.png = Frame 30 of animation in engine, rotation != rotation in Maya I use my custom tool to export data from the fbx file using the fbx sdk. The following is how i extract the skeleton bind pose and inverse bind pose transforms using fbx sdk: (Note: freeze transformation have been applied to the mesh, so i ignore the geometry transform since its just an identity) FbxAMatrix localTransform = p_Node->EvaluateLocalTransform(); joint->m_Location = localTransform.GetT(); joint->m_Scale = localTransform.GetS(); joint->m_Rotation = localTransform.GetQ(); FbxAMatrix inverseBindTransform = p_Node->EvaluateGlobalTransform().Inverse(); joint->m_InverseLocation = inverseBindTransform.GetT(); joint->m_InverseScale = inverseBindTransform.GetS(); joint->m_InverseRotation = inverseBindTransform.GetQ(); Then i extract information about each join for all keyframes, in this example i only sample rotation: for( int i=0; i<rotationCurve->KeyGetCount(); ++i ) { FbxAnimCurveKey key = rotationCurve->KeyGet( i ); FbxTime time = key.GetTime(); FbxAMatrix transform = p_Node->EvaluateLocalTransform( time ); // setup frame JointFrame frame; frame.m_IsRotation = true; frame.m_Frame = time.GetFrameCount( m_AnimFramerate ); frame.m_Rotation = transform.GetQ(); joint->m_RotationKeyframes.add( frame ); } When i look at the rotation values from Maya i see that sometimes the axis of the quaternion is 0,0,0 assuming that the axis is mData[0-2]. So i must be doing something wrong here right? Thats the fbx part. Then in my engine i load the resources. This is how i setup and update the skeleton transforms: (Note: m_Rotation is a quaternion) void pmJoint::computeMatrices( pmJoint * p_Parent ) { if( m_IsDirty ) { pmMath::matrixCreateTransform( &m_LocalTransform, m_Location, m_Scale, m_Rotation ); } if( p_Parent ) { if( p_Parent->m_IsDirty || m_IsDirty ) { m_WorldTransform = m_LocalTransform * p_Parent->m_WorldTransform; m_IsDirty = true; } } else if( m_IsDirty ) { m_WorldTransform = m_LocalTransform; } for( pmUInt32 i=0; i<m_Children.count(); ++i ) { m_Children[ i ]->computeMatrices( this ); } } So as you can see, all bones operate in their localspace using their parents world to update their world. Then to get the render matrices i call this function: void pmJoint::computeRenderMatrices() { m_RenderTransform = m_InversBindTransform * m_WorldTransform; for( pmUInt32 i=0; i<m_Children.count(); ++i ) { m_Children[ i ]->computeRenderMatrices(); } } The animation part is simply lerping and slerping. I get the problem no matter if i interpolate or just show keyframe poses, so i left that code out. Any input, idea or crazy thought is welcome. Im at a loss here.
  14. Matrix 16 byte alignment

    Thank you so much for taking the time to explain. Learning stuff everyday it seems :)
  15. Matrix 16 byte alignment

    Dropping support of x86 in favor to x64 might solve a lot of headaches. :wink:     Thank you, i was indeed compiling for x86. I recompiled my source for x64 and with the align directives i now seem to be able to use the "A" notation functions :)   Can you provide an explination to why this change is so significant?
  • Advertisement