• Content count

  • Joined

  • Last visited

Community Reputation

1330 Excellent

About lucky6969b

  • Rank

Personal Information

  • Interests
  1. When a body experiences a collision, there may be causing a bump or decal on the body itself, and the box shape or hull shape only affects the transformation, how do I make it affect the vertex buffer, because in soft bodies simulation, you could actually affect the vertex buffer, you can't with rigid bodies, if I cast a soft body on the rigid body with limited elasticity. ohhh. but real strange to me... how do I make this happen? Thanks Jack
  2. But if I let the physics run in its own thread, this has some advantages when I don't update the physics too much by leveraging it some time to sleep,the AI actually has time to counteract with what the physics is currently doing. Because physics is continuous, if I divide the 1.0 with the frame rate, I can get some continuous feel without the physics hogging the world transformations all the time, when the physics thread is sleeping, the AI can do its work now... Thanks Jack
  3. Okay, When updating AI after the physics, somehow the AI can "overpower" what the physics is trying to do... and the AI is futile, the physics will take over. Thanks Jack
  4. I don't know how to figure out the forces applied to the object affected.... void AgentMotionState::getWorldTransform(btTransform& worldTrans) const { btTransform t; btDefaultMotionState::getWorldTransform(t); D3DXMATRIX l_mat; D3DXMatrixIdentity(&l_mat); if (m_object) { // DX TRANSFORM l_mat = BT2DX_MATRIX(t); D3DXVECTOR3 scale, pos; D3DXQUATERNION quat; D3DXMatrixDecompose(&scale, &quat, &pos, &l_mat); Transform* l_transform = m_object->FindComponentByType(); // if setting positions here, the physics will dominate over AI l_transform->setPosition2(pos); l_transform->setRotation(quat); } // BULLET TRANSFORM worldTrans = t; }
  5. If I set the physics after AI, physics will dominate the final world transformations, which totally erased the world transformations calculated from the AI, or vice versa. I want to calculate the relative transformation when physics is in effect, how do I do that with btMotionState or derived classes with getWorldTransform overrided? Thanks Jack
  6. That solves nicely... Thanks Jack if(l_transform->m_MotionInfo->m_fS < 1.0f) { l_transform->m_MotionInfo->m_fS += ((l_transform->m_MotionInfo->m_fSpeed / l_transform->m_MotionInfo->m_fDist) * m_fElapsedTime); l_transform->setPosition2(GotoWaypoint(l_transform->m_MotionInfo->m_vStartPos, l_transform->m_MotionInfo->m_vEndPos, l_transform->m_MotionInfo->m_fS)); float x = l_transform->m_MotionInfo->m_vEndPos.x - l_transform->m_MotionInfo->m_vStartPos.x; float z = l_transform->m_MotionInfo->m_vEndPos.z - l_transform->m_MotionInfo->m_vStartPos.z; float fNewDir = atan2f(-x, -z); l_transform->setRotation(D3DXVECTOR3(fNewDir, 0.0f, 0.0f)); } // upon reached destination else if(l_transform->m_MotionInfo->m_fS > 1.0f) { //m_CharObject[i].ChangeAnimation(IDLE); l_transform->m_MotionInfo->m_fS = 1.0f; } // calculate new value, // this is the result of either the dest has reached or the character has collided // fS is set to 1.0 whenever this is encountered else if(l_transform->m_MotionInfo->m_fS == 1.0f) { // move character l_transform->m_MotionInfo->m_vEndPos = l_transform->nextWayPoint(); l_transform->m_MotionInfo->m_vStartPos = l_transform->getPosition(); D3DXVECTOR3 vDist = l_transform->m_MotionInfo->m_vEndPos - l_transform->m_MotionInfo->m_vStartPos; l_transform->m_MotionInfo->m_fDist = D3DXVec3Length(&vDist); // reset if (l_transform->m_MotionInfo->m_fDist > 0.1) { l_transform->m_MotionInfo->m_fS = 0.0f; } } }
  7. I am right now using the high performance counters, and the speed of the agent is 5 m/s If the distance is larger than 10meters, it is very slowy... l_transform->m_MotionInfo->m_fS += ((l_transform->m_MotionInfo->m_fSpeed / l_transform->m_MotionInfo->m_fDist) * m_fElapsedTime); Way too slooooooow..! But if I multiply it by a factor of 10, it is crazily fast... The agent stays at some waypoint, stands there for a while, then go to the next waypoint, I don't know why it waits fS is 0.0593374 fS is 0.0595481 fS is 0.0597553 fS is 0.0599701 fS is 0.0601748 fS is 0.0603783 fS is 0.0605615 fS is 0.0607767 fS is 0.060987 fS is 0.061208 fS is 0.0613958 fS is 0.0616221 fS is 0.0618306 fS is 0.0620498 fS is 0.0622616 fS is 0.0624997 fS is 0.0626887 fS is 0.0629133 fS is 0.0631273 fS is 0.0633261 fS is 0.0635207 fS is 0.0637409 fS is 0.0639357 fS is 0.0641703 fS is 0.064362 fS is 0.064564 fS is 0.0647534 fS is 0.0650121 fS is 0.065251 fS is 0.0654732 fS is 0.0656744 fS is 0.0659465 fS is 0.0661739
  8. How can I generate a graph if the geometry of the scene is a triangle chunk of mesh(es)? And I got those source of mesh(es) from some other places. Also, how do you simulate traffic, say you would have left, mid and right lanes, traffic lights etc
  9. I've read some materials that road network pathfinding is best done on a grid type of map. Since my world is fairly large, say 5km x 5km, it would be a lot of cells if I generate a grid on it, however, a hierarchical map would be more easily, but it is not very intuitive to do road network pathfinding on hierarchical maps? Thanks Jack
  10. Yes, I grasp the right materials now. I am going over them. thanks Jack
  11. If the perlin noise function only produces a scalar value (a float), how can I change it to a vector? You can't have the scalar to define the whole vector? Thanks Jack
  12. const D3DXQUATERNION& q = l_transform->getRotation(); D3DXVECTOR3 axis; FLOAT angle; D3DXQuaternionToAxisAngle(&q, &axis, &angle); Every time this function is called, the angle is positive... Update: I am wrong, sorry, I got some problems of the truck always turning right (the cab of the truck) Thanks Jack
  13. How to define a function for a problem?

    Hello, I want to animate a so-called 3-point (or 4-point) parking problem. The vehicle will drive forward to a certain way point, take a rear drive and drive up again... You know, you sometimes get some weird parking lot in the street... Thanks Jack
  14. If I have a certain set of criterion, say 2 fixed positions, the turning radius of the vehicle, the size and the speed of the vehicle I want to calculate 2 other positions in terms of some constraints, such as the surrounding blockers The goal of the function is the minimize the cost of the turn. What is the correct way to define this function? Thanks
  15. This library does have some advantage over recast in certain scenarios, such as the ones that when you need HPA to work with. In recast, it doesn't support HPA or it is very hard to achieve, as suggested by the author, when you have a fairly large extent as large as the global or a continent, it does give you an edge from this library. Thanks Jack