当前位置: 首页>>代码示例>>C++>>正文


C++ btTransform::setRotation方法代码示例

本文整理汇总了C++中btTransform::setRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ btTransform::setRotation方法的具体用法?C++ btTransform::setRotation怎么用?C++ btTransform::setRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在btTransform的用法示例。


在下文中一共展示了btTransform::setRotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getUnitMeterScalingAndUpAxisTransform

void getUnitMeterScalingAndUpAxisTransform(TiXmlDocument& doc, btTransform& tr, float& unitMeterScaling)
{
	TiXmlElement* unitMeter = doc.RootElement()->FirstChildElement("asset")->FirstChildElement("unit");
	if (unitMeter)
	{
		const char* meterText = unitMeter->Attribute("meter");
		printf("meterText=%s\n", meterText);
		unitMeterScaling = atof(meterText);
	}

	TiXmlElement* upAxisElem = doc.RootElement()->FirstChildElement("asset")->FirstChildElement("up_axis");
	if (upAxisElem)
	{
		std::string upAxisTxt = upAxisElem->GetText();
		if (upAxisTxt == "X_UP")
		{
			btQuaternion y2x(btVector3(0,0,1),SIMD_HALF_PI);
			tr.setRotation(y2x);
		}
		if (upAxisTxt == "Y_UP")
		{
			//assume Y_UP for now, to be compatible with assimp?
		}
		if (upAxisTxt == "Z_UP")
		{
			btQuaternion y2z(btVector3(1,0,0),-SIMD_HALF_PI);
			tr.setRotation(y2z);
		}
	}
}
开发者ID:JernejKorosec,项目名称:bullet3,代码行数:30,代码来源:LoadMeshFromCollada.cpp

示例2:

//**************************************************************************************************************************pose2DtoTf()
void PSMpositionNode::pose2DToTf(const geometry_msgs::Pose2D& pose, btTransform& t)
{
    t.setOrigin(btVector3(pose.x, pose.y, 0.0));
    btQuaternion q;
    q.setRPY(0, 0, pose.theta);
    t.setRotation(q);
}
开发者ID:sunzhusz,项目名称:pixhawk-kinect-pkg,代码行数:8,代码来源:mainNode.cpp

示例3: updateTriggerPosition

//-------------------------------------------------------------------------------------------------------
void Road::updateTriggerPosition(btTransform& trans)
{
    trans.setIdentity();
    trans.setOrigin(GameState::ogreVecToBullet(mPosition));
    Ogre::Quaternion rotation = Ogre::Vector3::UNIT_Z.getRotationTo(mDirection);
    trans.setRotation(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w));
}
开发者ID:fsxfreak,项目名称:Catreon,代码行数:8,代码来源:Road.cpp

示例4:

void	fbMotionState::getWorldTransform(btTransform& worldTrans) const
{
	assert(mVisualObj);
	worldTrans.setIdentity();
	worldTrans.setRotation(FBToBullet(mVisualObj->GetRot()));
	worldTrans.setOrigin(FBToBullet(mVisualObj->GetPos()));	
}
开发者ID:fastbird,项目名称:fastbirdEngine,代码行数:7,代码来源:fbMotionState.cpp

示例5: getWorldTransform

void MotionState::getWorldTransform(btTransform &transform) const
{
    lua_rawgeti(L, LUA_REGISTRYINDEX, component_ref);
    lua_getfield(L, -1, "transform");
    lua_remove(L, -2);
    // the stack now contains just the transform component
    
    // get the origin
    {
        lua_getfield(L, -1, "pos");
        double x, y, z;
        l_tovect(L, -1, &x, &y, &z);
        lua_pop(L, 1);

        transform.setOrigin(btVector3(x, y, z));
    }

    // get the rotation
    {
        lua_getfield(L, -1, "orientation");
        double w, x, y, z;
        l_toquaternion(L, -1, &w, &x, &y, &z);
        lua_pop(L, 1);

        transform.setRotation(btQuaternion(x, y, z, w));
    }

    lua_pop(L, 1);
}
开发者ID:henkboom,项目名称:dokidoki-physics,代码行数:29,代码来源:physics.cpp

示例6: getWorldTransform

// This callback is invoked by the physics simulation in two cases:
// (1) when the RigidBody is first added to the world
//     (irregardless of PhysicsMotionType: STATIC, DYNAMIC, or KINEMATIC)
// (2) at the beginning of each simulation step for KINEMATIC RigidBody's --
//     it is an opportunity for outside code to update the object's simulation position
void EntityMotionState::getWorldTransform(btTransform& worldTrans) const {
    BT_PROFILE("getWorldTransform");
    if (!_entity) {
        return;
    }
    assert(entityTreeIsLocked());
    if (_motionType == MOTION_TYPE_KINEMATIC) {
        BT_PROFILE("kinematicIntegration");
        uint32_t thisStep = ObjectMotionState::getWorldSimulationStep();
        if (hasInternalKinematicChanges()) {
            // ACTION_CAN_CONTROL_KINEMATIC_OBJECT_HACK: This kinematic body was moved by an Action
            // and doesn't require transform update because the body is authoritative and its transform
            // has already been copied out --> do no kinematic integration.
            clearInternalKinematicChanges();
            _lastKinematicStep = thisStep;
            return;
        }
        // This is physical kinematic motion which steps strictly by the subframe count
        // of the physics simulation and uses full gravity for acceleration.
        _entity->setAcceleration(_entity->getGravity());

        float dt = (thisStep - _lastKinematicStep) * PHYSICS_ENGINE_FIXED_SUBSTEP;
        _lastKinematicStep = thisStep;
        _entity->stepKinematicMotion(dt);

        // and set the acceleration-matches-gravity count high so that if we send an update
        // it will use the correct acceleration for remote simulations
        _accelerationNearlyGravityCount = (uint8_t)(-1);
    }
    worldTrans.setOrigin(glmToBullet(getObjectPosition()));
    worldTrans.setRotation(glmToBullet(_entity->getWorldOrientation()));
}
开发者ID:Menithal,项目名称:hifi,代码行数:37,代码来源:EntityMotionState.cpp

示例7: getWorldTransform

// This callback is invoked by the physics simulation in two cases:
// (1) when the RigidBody is first added to the world
//     (irregardless of PhysicsMotionType: STATIC, DYNAMIC, or KINEMATIC)
// (2) at the beginning of each simulation step for KINEMATIC RigidBody's --
//     it is an opportunity for outside code to update the object's simulation position
void EntityMotionState::getWorldTransform(btTransform& worldTrans) const {
    BT_PROFILE("getWorldTransform");
    if (!_entity) {
        return;
    }
    assert(entityTreeIsLocked());
    if (_motionType == MOTION_TYPE_KINEMATIC) {
        BT_PROFILE("kinematicIntegration");
        // This is physical kinematic motion which steps strictly by the subframe count
        // of the physics simulation and uses full gravity for acceleration.
        _entity->setAcceleration(_entity->getGravity());
        uint32_t thisStep = ObjectMotionState::getWorldSimulationStep();
        float dt = (thisStep - _lastKinematicStep) * PHYSICS_ENGINE_FIXED_SUBSTEP;
        _entity->stepKinematicMotion(dt);

        // bypass const-ness so we can remember the step
        const_cast<EntityMotionState*>(this)->_lastKinematicStep = thisStep;

        // and set the acceleration-matches-gravity count high so that if we send an update
        // it will use the correct acceleration for remote simulations
        _accelerationNearlyGravityCount = (uint8_t)(-1);
    }
    worldTrans.setOrigin(glmToBullet(getObjectPosition()));
    worldTrans.setRotation(glmToBullet(_entity->getRotation()));
}
开发者ID:imgntn,项目名称:hifi,代码行数:30,代码来源:EntityMotionState.cpp

示例8: getWorldTransform

// virtual
void AvatarMotionState::getWorldTransform(btTransform& worldTrans) const {
    worldTrans.setOrigin(glmToBullet(getObjectPosition()));
    worldTrans.setRotation(glmToBullet(getObjectRotation()));
    if (_body) {
        _body->setLinearVelocity(glmToBullet(getObjectLinearVelocity()));
        _body->setAngularVelocity(glmToBullet(getObjectAngularVelocity()));
    }
}
开发者ID:Nex-Pro,项目名称:hifi,代码行数:9,代码来源:AvatarMotionState.cpp

示例9: getWorldTransform

	virtual void getWorldTransform(btTransform& tform) const
	{
		const auto& p = m_part->dummy->getDefaultTranslation();
		const auto& o = glm::toQuat(m_part->dummy->getDefaultRotation());
		tform.setOrigin(btVector3(p.x, p.y, p.z));
		tform.setRotation(btQuaternion(o.x, o.y, o.z, o.w));
		tform = m_object->collision->getBulletBody()->getWorldTransform() * tform;
	}
开发者ID:JayFoxRox,项目名称:openrw,代码行数:8,代码来源:VehicleObject.cpp

示例10: getWorldTransform

void EntityMotionState::getWorldTransform(btTransform& transform) const {
    if(!owner) {
	transform = original_transform;
	return;
    }

    const float* position = owner->getPosition();
    transform.setOrigin(btVector3(position[0], position[1], position[2]));
    const float* rotation = owner->getQuaternionRotation();
    transform.setRotation(btQuaternion(rotation[0], rotation[1], rotation[2], rotation[3]));
}
开发者ID:Df458,项目名称:DFEngine-Old-,代码行数:11,代码来源:EntityMotionState.cpp

示例11: getWorldTransform

    /// btMotionState override. Called when Bullet wants us to tell the body's initial transform
    void getWorldTransform(btTransform &worldTrans) const
    {
        if (placeable.Expired())
            return;

        float3 position = placeable->WorldPosition();
        Quat orientation = placeable->WorldOrientation();
    
        worldTrans.setOrigin(position);
        worldTrans.setRotation(orientation);
    }
开发者ID:realXtend,项目名称:tundra-urho3d,代码行数:12,代码来源:RigidBody.cpp

示例12: GetOffsetTransform

 void DiBone::GetOffsetTransform(btTransform& t) const
 {
     DiVec3 locScale = GetDerivedScale() * mBindDerivedInverseScale;
     DiQuat locRotate = GetDerivedOrientation() * mBindDerivedInverseOrientation;
     DiVec3 locTranslate = GetDerivedPosition() +
     locRotate * (locScale * mBindDerivedInversePosition);
     t.setOrigin(btVector3(locTranslate.x,locTranslate.y,locTranslate.z));
     btQuaternion qt;
     qt.setValue(locRotate.x,locRotate.y,locRotate.z,locRotate.w);
     t.setRotation(qt);
     t.setBasis(t.getBasis().scaled(btVector3(locScale.x, locScale.y, locScale.z)));
 }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:12,代码来源:Bone.cpp

示例13: getWorldTransform

void RigidBody::getWorldTransform(btTransform& worldTrans) const
{
    // We may be in a pathological state where a RigidBody exists without a scene node when this callback is fired,
    // so check to be sure
    if (node_)
    {
        lastPosition_ = node_->GetWorldPosition();
        lastRotation_ = node_->GetWorldRotation();
        worldTrans.setOrigin(ToBtVector3(lastPosition_ + lastRotation_ * centerOfMass_));
        worldTrans.setRotation(ToBtQuaternion(lastRotation_));
    }
}
开发者ID:quinsmpang,项目名称:Urho3D,代码行数:12,代码来源:RigidBody.cpp

示例14: getJointInfo

bool ROSURDFImporter::getJointInfo(int urdfLinkIndex, btTransform& parent2joint, btVector3& jointAxisInJointSpace, int& jointType, btScalar& jointLowerLimit, btScalar& jointUpperLimit) const
{
    jointLowerLimit = 0.f;
    jointUpperLimit = 0.f;
        
    if ((*m_data->m_links[urdfLinkIndex]).parent_joint)
    {
        my_shared_ptr<Joint> pj =(*m_data->m_links[urdfLinkIndex]).parent_joint;
            
        const urdf::Vector3 pos = pj->parent_to_joint_origin_transform.position;
        const urdf::Rotation orn = pj->parent_to_joint_origin_transform.rotation;
            
        jointAxisInJointSpace.setValue(pj->axis.x,pj->axis.y,pj->axis.z);
        parent2joint.setOrigin(btVector3(pos.x,pos.y,pos.z));
        parent2joint.setRotation(btQuaternion(orn.x,orn.y,orn.z,orn.w));

        switch (pj->type)
        {
            case Joint::REVOLUTE:
                jointType = URDFRevoluteJoint;
                break;
            case Joint::FIXED:
                jointType = URDFFixedJoint;
                break;
            case Joint::PRISMATIC:
                jointType = URDFPrismaticJoint;
                break;
            case Joint::PLANAR:
                jointType = URDFPlanarJoint;
                break;
            case Joint::CONTINUOUS:
				jointType = URDFContinuousJoint;
                break;
            default:
            {
                printf("Error: unknown joint type %d\n", pj->type);
                btAssert(0);
            }
                    
        };
            
        if (pj->limits)
        {
            jointLowerLimit = pj->limits.get()->lower;
            jointUpperLimit = pj->limits.get()->upper;
        }
        return true;
    } else
    {
        parent2joint.setIdentity();
        return false;
    }
}
开发者ID:Oddity007,项目名称:ExplorationViaPainting,代码行数:53,代码来源:ROSURDFImporter.cpp

示例15: getMassAndInertia

void  ROSURDFImporter::getMassAndInertia(int linkIndex, btScalar& mass,btVector3& localInertiaDiagonal, btTransform& inertialFrame) const
{
    if ((*m_data->m_links[linkIndex]).inertial)
    {
        mass = (*m_data->m_links[linkIndex]).inertial->mass;
        localInertiaDiagonal.setValue((*m_data->m_links[linkIndex]).inertial->ixx,(*m_data->m_links[linkIndex]).inertial->iyy,(*m_data->m_links[linkIndex]).inertial->izz);
        inertialFrame.setOrigin(btVector3((*m_data->m_links[linkIndex]).inertial->origin.position.x,(*m_data->m_links[linkIndex]).inertial->origin.position.y,(*m_data->m_links[linkIndex]).inertial->origin.position.z));
        inertialFrame.setRotation(btQuaternion((*m_data->m_links[linkIndex]).inertial->origin.rotation.x,(*m_data->m_links[linkIndex]).inertial->origin.rotation.y,(*m_data->m_links[linkIndex]).inertial->origin.rotation.z,(*m_data->m_links[linkIndex]).inertial->origin.rotation.w));
    } else
    {
        mass = 1.f;
        localInertiaDiagonal.setValue(1,1,1);
        inertialFrame.setIdentity();
    }
}
开发者ID:Oddity007,项目名称:ExplorationViaPainting,代码行数:15,代码来源:ROSURDFImporter.cpp


注:本文中的btTransform::setRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。