Exemple #1
0
csVector3 csBulletPivotJoint::GetPosition () const
{
  if (!constraint)
    return csVector3 (0.0f);

  return BulletToCS (constraint->getPivotInB (), dynSys->inverseInternalScale);
}
csVector3 csBulletRigidBody::GetLinearVelocity (size_t index /* = 0 */) const
{
  if (!btBody)
    return linearVelocity;

  const btVector3& vel = btBody->getLinearVelocity ();
  return BulletToCS (vel, system->getInverseInternalScale ());
}
Exemple #3
0
    bool csBulletCollider::GetBoxGeometry (csVector3& size)
    {
        if (geomType != BOX_COLLIDER_GEOMETRY)
            return false;

        btBoxShape* geometry = static_cast<btBoxShape*> (shape);
        btVector3 btSize = geometry->getHalfExtentsWithMargin ();
        size.Set (BulletToCS (btSize, dynSys->inverseInternalScale));
        size *= 2.0f;

        return true;
    }
Exemple #4
0
    bool csBulletCollider::GetConvexMeshGeometry (csVector3*& vertices, size_t& vertexCount,
            int*& indices, size_t& triangleCount)
    {
        if (geomType != CONVEXMESH_COLLIDER_GEOMETRY)
            return false;

        triangleCount = this->triangleCount;
        delete[] indices;
        indices = new int[this->triangleCount * 3];
        for (unsigned int i = 0; i < triangleCount * 3; i++)
            indices[i] = this->indices[i];

        vertexCount = this->vertexCount;
        delete[] vertices;
        vertices = new csVector3[this->vertexCount];
        for (unsigned int i = 0; i < vertexCount; i++)
            vertices[i].Set (BulletToCS (this->vertices[i], dynSys->inverseInternalScale));

        return true;
    }