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


C++ Bone::GetNode方法代码示例

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


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

示例1: BuildTail

bool Skeleton_Builder::BuildTail(float tail_width, float tail_height, float torso_height)
{
	Bone* UTail = new Bone();
	Bone* MTail = new Bone();
	Bone* LTail = new Bone();
	Bone* LLTail = new Bone();
	tail_height /= 4;
	
	Ogre::Quaternion neckrotation;
	neckrotation.FromAngleAxis(Ogre::Radian(Ogre::Degree(mTailIncline)), Ogre::Vector3::UNIT_X);
	btTransform t;
	btVector3 min, max;

	mHipNode->GetCollider()->getAabb(t, min, max);
	mBuilder->SetDimensions(tail_width, tail_height, mDepth / 2);
	mBuilder->SetRelativePosition(Ogre::Vector3(0, -(torso_height /2), mDepth / 2), neckrotation, *mHipNode->GetNode());
	if (!mBuilder->BuildBone(*LLTail, Bone::BoneType::Tail))
		return false;
	mBuilder->SetDimensions(tail_width, tail_height, mDepth / 2);
	mBuilder->SetRelativePosition(Ogre::Vector3(0, -tail_height , 0), neckrotation, *LLTail->GetNode());
	if (!mBuilder->BuildBone(*LTail, Bone::BoneType::Tail))
		return false;
	mBuilder->SetDimensions(tail_width, tail_height, mDepth / 2);
	mBuilder->SetRelativePosition(Ogre::Vector3(0, -tail_height, 0), neckrotation, *LTail->GetNode());
	if (!mBuilder->BuildBone(*MTail, Bone::BoneType::Tail))
		return false;
	mBuilder->SetDimensions(tail_width, tail_height, mDepth / 2);
	mBuilder->SetRelativePosition(Ogre::Vector3(0, -tail_height, 0), neckrotation, *MTail->GetNode());
	if (!mBuilder->BuildBone(*UTail, Bone::BoneType::Tail))
		return false;
	if (mHasMuscle)
	{
		mMuscleBuilder->CreateMuscle(mHipNode, LLTail, mMuscles);
		mMuscleBuilder->CreateMuscle(LLTail, LTail, mMuscles);
		mMuscleBuilder->CreateMuscle(LTail, MTail, mMuscles);
		mMuscleBuilder->CreateMuscle(MTail, UTail, mMuscles);
	}

	//add joints
	btTransform localA, localB;
	btVector3 JointPos;

	JointPos = Utils::OgreBTVector(mHipNode->GetNode()->_getDerivedPosition() + Ogre::Vector3(0, (torso_height / 2), 0));
	SetJointTransform(localA, localB, JointPos, mHipNode, LLTail, btVector3(0, btScalar(-M_PI_2), 0));
	btConeTwistConstraint* shoulderNeckConst = new btConeTwistConstraint(*mHipNode->GetRigidBody(), *LLTail->GetRigidBody(), localA, localB);
	shoulderNeckConst->setLimit(btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4),btScalar(M_PI_4 / 4));

	JointPos = Utils::OgreBTVector(LLTail->GetNode()->_getDerivedPosition() + Ogre::Vector3(0, (tail_height), 0));
	SetJointTransform(localA, localB, JointPos, LLTail, LTail, btVector3(0, btScalar(-M_PI_2), 0));
	btConeTwistConstraint* LNeckConst = new btConeTwistConstraint(*LLTail->GetRigidBody(), *LTail->GetRigidBody(), localA, localB);
	LNeckConst->setLimit(btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4));

	JointPos = Utils::OgreBTVector(LTail->GetNode()->_getDerivedPosition() + Ogre::Vector3(0, (tail_height), 0));
	SetJointTransform(localA, localB, JointPos, LTail, MTail, btVector3(0, btScalar(-M_PI_2), 0));
	btConeTwistConstraint* MNeckConst = new btConeTwistConstraint(*LTail->GetRigidBody(), *MTail->GetRigidBody(), localA, localB);
	MNeckConst->setLimit(btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4));

	JointPos = Utils::OgreBTVector(MTail->GetNode()->_getDerivedPosition() + Ogre::Vector3(0, (tail_height), 0));
	SetJointTransform(localA, localB, JointPos, MTail, UTail, btVector3(0, btScalar(-M_PI_2), 0));
	btConeTwistConstraint* HNeckConst = new btConeTwistConstraint(*MTail->GetRigidBody(), *UTail->GetRigidBody(), localA, localB);
	HNeckConst->setLimit(btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4));

	mConstraints.push_back(shoulderNeckConst);
	mConstraints.push_back(LNeckConst);
	mConstraints.push_back(MNeckConst);
	mConstraints.push_back(HNeckConst);

	return true;
}
开发者ID:nathn123,项目名称:FYP,代码行数:69,代码来源:Skeleton_Builder.cpp

示例2: BuildLeg

bool Skeleton_Builder::BuildLeg(float leg_width, float leg_height, float torso_width, float torso_height)
{
	auto halfgap = (torso_width / 2) - leg_width;
	auto legnodepos = halfgap + leg_width / 2;

	Bone* LUpperLeg = new Bone();
	Bone* LLowerLeg = new Bone();
	Bone* LFoot = new Bone();
	Bone* RUpperLeg = new Bone();
	Bone* RLowerLeg = new Bone();
	Bone* RFoot = new Bone();
	if (mLeg == LegType::Uninverted)
	{
		mBuilder->SetDimensions(leg_width, leg_height / 2, mDepth *0.75f);
		mBuilder->SetRelativePosition(Ogre::Vector3(legnodepos, -((torso_height / 2) + (leg_height / 4)), 0), Ogre::Quaternion::IDENTITY, *mHipNode->GetNode());
		if (!mBuilder->BuildBone(*LUpperLeg,Bone::BoneType::LUpperLeg))
			return false;
		mBuilder->SetDimensions(leg_width, leg_height / 2, mDepth *0.75f);
		mBuilder->SetRelativePosition(Ogre::Vector3(-legnodepos, -((torso_height / 2) + (leg_height / 4)), 0), Ogre::Quaternion::IDENTITY, *mHipNode->GetNode());
		if (!mBuilder->BuildBone(*RUpperLeg, Bone::BoneType::RUpperLeg))
			return false;
		mBuilder->SetDimensions(leg_width, leg_height / 2, mDepth *0.75f);
		mBuilder->SetRelativePosition(Ogre::Vector3(0, -leg_height / 2, 0), Ogre::Quaternion::IDENTITY, *LUpperLeg->GetNode());
		if (!mBuilder->BuildBone(*LLowerLeg, Bone::BoneType::LowerLeg))
			return false;
		mBuilder->SetDimensions(leg_width, leg_height / 2, mDepth *0.75f);
		mBuilder->SetRelativePosition(Ogre::Vector3(0, -leg_height / 2, 0), Ogre::Quaternion::IDENTITY, *RUpperLeg->GetNode());
		if (!mBuilder->BuildBone(*RLowerLeg, Bone::BoneType::LowerLeg))
			return false;

		// foot generation
		mBuilder->SetDimensions(leg_width*1.5f, leg_height / 4, mDepth);
		mBuilder->SetRelativePosition(Ogre::Vector3(0, -leg_height / 2, 0), Ogre::Quaternion::IDENTITY, *LLowerLeg->GetNode());
		if (!mBuilder->BuildBone(*LFoot,Bone::BoneType::Foot))
			return false;
		mBuilder->SetDimensions(leg_width*1.5f, leg_height / 4, mDepth);
		mBuilder->SetRelativePosition(Ogre::Vector3(0, -leg_height / 2, 0), Ogre::Quaternion::IDENTITY, *RLowerLeg->GetNode());
		if (!mBuilder->BuildBone(*RFoot, Bone::BoneType::Foot))
			return false;

	}
	else
	{
		//mBuilder->SetDimensions(leg_width, leg_height / 2);
		//mBuilder->SetRelativePosition(Ogre::Vector3(legnodepos, 0, 0), Ogre::Quaternion::IDENTITY, *mHipNode->GetNode());
		//if (!mBuilder->BuildBone(*LUpperLeg))
		//	return false;
		//mBuilder->SetDimensions(leg_width, leg_height / 2);
		//mBuilder->SetRelativePosition(Ogre::Vector3(0, leg_height / 2, 0), Ogre::Quaternion::IDENTITY, *LUpperLeg->GetNode());
		//if (!mBuilder->BuildBone(*LLowerLeg))
		//	return false;
		// foot generation
		//mBuilder->SetDimensions(leg_width, leg_height / 2);
		//mBuilder->SetRelativePosition(Ogre::Vector3(legnodepos, 0, 0), Ogre::Quaternion::IDENTITY, Hip->GetNode());
		//if (!mBuilder->BuildBone(LUpperLeg))
		//	return false;
		//mBuilder->SetDimensions(leg_width, leg_height / 2);
		//mBuilder->SetRelativePosition(Ogre::Vector3(-legnodepos, 0, 0), Ogre::Quaternion::IDENTITY, *mHipNode->GetNode());
		//if (!mBuilder->BuildBone(*RUpperLeg))
		//	return false;
		//mBuilder->SetDimensions(leg_width, leg_height / 2);
		//mBuilder->SetRelativePosition(Ogre::Vector3(0, leg_height / 2, 0), Ogre::Quaternion::IDENTITY, *RUpperLeg->GetNode());
		//if (!mBuilder->BuildBone(*RLowerLeg))
		//	return false;
		// foot generation
		//mBuilder->SetDimensions(leg_width, leg_height / 2);
		//mBuilder->SetRelativePosition(Ogre::Vector3(legnodepos, 0, 0), Ogre::Quaternion::IDENTITY, Hip->GetNode());
		//if (!mBuilder->BuildBone(LUpperLeg))
		//	return false;
	}
	mBones.push_back(LUpperLeg);
	mBones.push_back(RUpperLeg);
	mBones.push_back(LLowerLeg);
	mBones.push_back(RLowerLeg);
	mBones.push_back(LFoot);
	mBones.push_back(RFoot);
	if (mHasMuscle)
	{
		mMuscleBuilder->CreateMuscle(mHipNode, LUpperLeg, mMuscles);
		mMuscleBuilder->CreateMuscle(LUpperLeg, LLowerLeg, mMuscles);
		mMuscleBuilder->CreateMuscle(LLowerLeg, LFoot, mMuscles);

		mMuscleBuilder->CreateMuscle(mHipNode, RUpperLeg, mMuscles);
		mMuscleBuilder->CreateMuscle(RUpperLeg, RLowerLeg, mMuscles);
		mMuscleBuilder->CreateMuscle(RLowerLeg, RFoot, mMuscles);
	}
	//add joints
	Ogre::Vector3 offset;
	btTransform localA, localB;
	btVector3 JointPos;

	JointPos = Utils::OgreBTVector(mHipNode->GetNode()->_getDerivedPosition() + Ogre::Vector3(legnodepos, -(torso_height / 2), 0));
	SetJointTransform(localA, localB, JointPos, mHipNode, LUpperLeg, btVector3(0, btScalar(M_PI_2), 0));
	btConeTwistConstraint* LhipConst = new btConeTwistConstraint(*mHipNode->GetRigidBody(), *LUpperLeg->GetRigidBody(), localA, localB);
	LhipConst->setLimit(btScalar(M_PI_4), btScalar(M_PI_4), 0);

	JointPos = Utils::OgreBTVector(mHipNode->GetNode()->_getDerivedPosition() + Ogre::Vector3(-legnodepos, -(torso_height / 2), 0));
	SetJointTransform(localA, localB, JointPos, mHipNode, RUpperLeg, btVector3(0, 0, btScalar(M_PI_4)));
	btConeTwistConstraint* RhipConst = new btConeTwistConstraint(*mHipNode->GetRigidBody(), *RUpperLeg->GetRigidBody(), localA, localB);
	RhipConst->setLimit(btScalar(M_PI_4), btScalar(M_PI_4), 0);
//.........这里部分代码省略.........
开发者ID:nathn123,项目名称:FYP,代码行数:101,代码来源:Skeleton_Builder.cpp

示例3: BuildNeck

bool Skeleton_Builder::BuildNeck(float neck_width, float neck_height, float torso_height)
{
	Bone* UNeck = new Bone();
	Bone* MNeck = new Bone();
	Bone* LNeck = new Bone();
	Bone* LLNeck = new Bone();
	neck_height /= 4;
	mBuilder->SetDimensions(neck_width, neck_height, mDepth * 0.5f);
	Ogre::Quaternion neckrotation;
	neckrotation.FromAngleAxis(Ogre::Radian(Ogre::Degree(mNeckIncline)), Ogre::Vector3::UNIT_X);

	mBuilder->SetRelativePosition(Ogre::Vector3(0, neck_height, 0), neckrotation, *mShouldernode->GetNode());
	if (!mBuilder->BuildBone(*LLNeck,Bone::BoneType::Neck))
		return false;
	mBuilder->SetDimensions(neck_width, neck_height, mDepth * 0.5f);
	mBuilder->SetRelativePosition(Ogre::Vector3(0, neck_height, 0), neckrotation, *LLNeck->GetNode());
	if (!mBuilder->BuildBone(*LNeck, Bone::BoneType::Neck))
		return false;
	mBuilder->SetDimensions(neck_width, neck_height, mDepth * 0.5f);
	mBuilder->SetRelativePosition(Ogre::Vector3(0, neck_height, 0), neckrotation, *LNeck->GetNode());
	if (!mBuilder->BuildBone(*MNeck, Bone::BoneType::Neck))
		return false;
	mBuilder->SetDimensions(neck_width, neck_height, mDepth * 0.5f);
	mBuilder->SetRelativePosition(Ogre::Vector3(0, neck_height, 0), neckrotation, *MNeck->GetNode());
	if (!mBuilder->BuildBone(*UNeck, Bone::BoneType::Neck))
		return false;
	if (mHasMuscle)
	{
		mMuscleBuilder->CreateMuscle(mShouldernode, LLNeck, mMuscles);
		mMuscleBuilder->CreateMuscle(LLNeck, LNeck, mMuscles);
		mMuscleBuilder->CreateMuscle(LNeck, MNeck, mMuscles);
		mMuscleBuilder->CreateMuscle(MNeck, UNeck, mMuscles);
	}
	
	//add joints
	btTransform localA, localB;
	btVector3 JointPos;

	JointPos = Utils::OgreBTVector(mShouldernode->GetNode()->_getDerivedPosition() + Ogre::Vector3(0, (torso_height / 2), 0));
	SetJointTransform(localA, localB, JointPos, mShouldernode, LLNeck, btVector3(0, btScalar(-M_PI_2), 0));
	btConeTwistConstraint* shoulderNeckConst = new btConeTwistConstraint(*mShouldernode->GetRigidBody(), *LLNeck->GetRigidBody(), localA, localB);
	shoulderNeckConst->setLimit(btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4));

	JointPos = Utils::OgreBTVector(LLNeck->GetNode()->_getDerivedPosition() + Ogre::Vector3(0, (neck_height / 2), 0));
	SetJointTransform(localA, localB, JointPos, LLNeck, LNeck, btVector3(0, btScalar(-M_PI_2), 0));
	btConeTwistConstraint* LNeckConst = new btConeTwistConstraint(*LLNeck->GetRigidBody(), *LNeck->GetRigidBody(), localA, localB);
	LNeckConst->setLimit(btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4));

	JointPos = Utils::OgreBTVector(mHipNode->GetNode()->_getDerivedPosition() + Ogre::Vector3(0, (neck_height / 2), 0));
	SetJointTransform(localA, localB, JointPos, LNeck, MNeck, btVector3(0, btScalar(-M_PI_2), 0));
	btConeTwistConstraint* MNeckConst = new btConeTwistConstraint(*LNeck->GetRigidBody(), *MNeck->GetRigidBody(), localA, localB);
	MNeckConst->setLimit(btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4));

	JointPos = Utils::OgreBTVector(mHipNode->GetNode()->_getDerivedPosition() + Ogre::Vector3(0, (neck_height / 2), 0));
	SetJointTransform(localA, localB, JointPos, MNeck, UNeck, btVector3(0, btScalar(-M_PI_2), 0));
	btConeTwistConstraint* HNeckConst = new btConeTwistConstraint(*MNeck->GetRigidBody(), *UNeck->GetRigidBody(), localA, localB);
	HNeckConst->setLimit(btScalar(M_PI_4 / 4), btScalar(M_PI_4 / 4),btScalar(M_PI_4 / 4));

	mConstraints.push_back(shoulderNeckConst);
	mConstraints.push_back(LNeckConst);
	mConstraints.push_back(MNeckConst);
	mConstraints.push_back(HNeckConst);

	return true;
}
开发者ID:nathn123,项目名称:FYP,代码行数:65,代码来源:Skeleton_Builder.cpp

示例4: BuildSkeleton

bool Skeleton_Builder::BuildSkeleton(Skeleton& newSkel, Ogre::Vector3 pos)
{
	if (mLeg == LegType::None || mHeight <= 10) // check to ensure all attribs required
		return false;
	
	float neck_height;
	float torso_height;
	float Leg_height;
	float tail_height;
	//create base node for skeleton
	mBase = mSceneMgr->getRootSceneNode()->createChildSceneNode(pos);
	// set block area heights
	// if longneck  neck/legs ratio = 2:1
	// if shortneck neck/legs ratio = 1:2
	// if upright torso 40% 
	// else torso 25% 
	
	
	if (IsUpright())
	{
		auto onepercent = mHeight / 100;
		Leg_height = onepercent * 40;
		if (IsLongNeck())
		{
			neck_height = onepercent * 40;
			torso_height = onepercent * 20;
		}
		else
		{
			neck_height = onepercent * 20;
			torso_height = onepercent * 40;
		}
	}
	else
	{
		auto onepercent = mHeight / 100;
		torso_height = onepercent * 25;
		if (IsLongNeck())
		{
			neck_height = onepercent * 50;
			Leg_height = onepercent * 25;
		}
		else
		{
			neck_height = onepercent * 25;
			Leg_height = onepercent * 50;
		}
	}
	if (IsLongTail())
	{
		auto onepercent = mHeight / 100;
		tail_height = onepercent * 50;
	}
	else
	{
		auto onepercent = mHeight / 100;
		tail_height = onepercent * 25;
	}

	//set block area widths
	float neck_width;
	float torso_width;
	float Leg_width;
	float Arm_width;

	auto onepercentW = mWidth / 100;
	// arms take 35% of width i.e 17.5% each side if needed
	torso_width = onepercentW * 65;
	Leg_width = onepercentW * 25; // ensures gaps between legs like realistic bipeds
	Arm_width = onepercentW * 17.5f;
	neck_width = onepercentW * 35;

	//build the torso here
	Bone* CentreTorso = new Bone();
	if (IsUpright())
	{
		
		Bone* TopTorso = new Bone();
		Bone* BotTorso = new Bone();
		//build 3 torso pieces
		torso_height /= 3;
		//build centre piece
		mBuilder->SetDimensions(torso_width, torso_height, mDepth);
		mBuilder->SetRelativePosition(Ogre::Vector3::ZERO, Ogre::Quaternion::IDENTITY,*mBase);
		if (!mBuilder->BuildBone(*CentreTorso,Bone::BoneType::Torso))
			return false;
		//build bot piece
		mBuilder->SetDimensions(torso_width, torso_height, mDepth);
		mBuilder->SetRelativePosition(Ogre::Vector3(0, -(torso_height), 0), Ogre::Quaternion::IDENTITY, *CentreTorso->GetNode());
		if (!mBuilder->BuildBone(*BotTorso,Bone::BoneType::Hip))
			return false;
		//build top piece
		mBuilder->SetDimensions(torso_width, torso_height, mDepth);
		mBuilder->SetRelativePosition(Ogre::Vector3(0, (torso_height), 0), Ogre::Quaternion::IDENTITY, *CentreTorso->GetNode());
		if (!mBuilder->BuildBone(*TopTorso, Bone::BoneType::Shoulder))
			return false;
		mShouldernode = TopTorso;
		mHipNode = BotTorso;

		mBones.push_back(CentreTorso);
//.........这里部分代码省略.........
开发者ID:nathn123,项目名称:FYP,代码行数:101,代码来源:Skeleton_Builder.cpp

示例5: BuildArm

bool Skeleton_Builder::BuildArm(float arm_Width, float arm_height, float torso_width)
{
	// 3 blocks no hands
	// only height/ width changes 
	//if (mArm == ArmType::ShortArms)
	//{
	//	//half height of legs
	//	Bone* LUpperArm = new Bone();
	//	Bone* LLowerArm = new Bone();
	//	//build shoulder piece
	//	torso_width /= 2;
	//	mBuilder->SetDimensions(arm_Width, arm_height/2);
	//	mBuilder->SetRelativePosition(Ogre::Vector3(torso_width, 0, 0), Ogre::Quaternion::IDENTITY, *mShouldernode->GetNode());
	//	if (!mBuilder->BuildBone(*LUpperArm))
	//		return false;
	//	

	//	mBuilder->SetDimensions(arm_Width, arm_height / 2);
	//	mBuilder->SetRelativePosition(Ogre::Vector3(0, arm_height / 2, 0), Ogre::Quaternion::IDENTITY, *LUpperArm->GetNode());
	//	if (!mBuilder->BuildBone(*LLowerArm))
	//		return false;

	//	mBones.push_back(LUpperArm);
	//	mBones.push_back(LLowerArm);

	//	//Bone* RUpperArm = new Bone();
	//	//Bone* RLowerArm = new Bone();

	//	//mBuilder->SetDimensions(arm_Width, arm_height / 2);
	//	//mBuilder->SetRelativePosition(Ogre::Vector3(-torso_width, 0, 0), Ogre::Quaternion::IDENTITY, *mShouldernode->GetNode());
	//	//if (!mBuilder->BuildBone(*RUpperArm))
	//	//	return false;
	//	//
	//	//mBuilder->SetDimensions(arm_Width, arm_height / 2);
	//	//mBuilder->SetRelativePosition(Ogre::Vector3(0, arm_height / 2, 0), Ogre::Quaternion::IDENTITY, *RUpperArm->GetNode());
	//	//if (!mBuilder->BuildBone(*RLowerArm))
	//	//	return false;

	//	//mBones.push_back(RUpperArm);
	//	//mBones.push_back(RLowerArm);
	//	//add joints
	//	btTransform localA, localB;
	//	Ogre::Vector3 offset;
	//	offset = Ogre::Vector3(torso_width, 0, 0);
	//	//auto vec = mShouldernode->GetNode()->_getDerivedPosition();
	//	//vec += offset;

	//	SetJointTransform(localA, localB, Utils::OgreBTVector(mShouldernode->GetNode()->_getDerivedPosition() + offset), mShouldernode, LUpperArm);
	//	btConeTwistConstraint* LshoulderConst = new btConeTwistConstraint(*mShouldernode->GetRigidBody(), *LUpperArm->GetRigidBody(), localA, localB);
	//	LshoulderConst->setLimit(M_PI_2, M_PI_2, 0);
	//	//SetJointTransform(localA, localB, Utils::OgreBTVector(mShouldernode->GetNode()->_getDerivedPosition() - offset), mShouldernode, RUpperArm);
	//	//btConeTwistConstraint* RshoulderConst = new btConeTwistConstraint(*mShouldernode->GetRigidBody(), *RUpperArm->GetRigidBody(), localA, localB);
	//	//RshoulderConst->setLimit(M_PI_2, M_PI_2, 0);

	//	offset = Ogre::Vector3(0, arm_height/4, 0);

	//	SetJointTransform(localA, localB, Utils::OgreBTVector(LUpperArm->GetNode()->_getDerivedPosition() - offset), LUpperArm, LLowerArm);
	//	btHingeConstraint* LArmConst = new btHingeConstraint(*LUpperArm->GetRigidBody(), *LLowerArm->GetRigidBody(), localA, localB);

	//	//SetJointTransform(localA, localB, Utils::OgreBTVector(RUpperArm->GetNode()->_getDerivedPosition() - offset), RUpperArm, RLowerArm);
	//	//btHingeConstraint* RArmConst = new btHingeConstraint(*RUpperArm->GetRigidBody(), *RLowerArm->GetRigidBody(), localA, localB);

	//	mConstraints.push_back(LshoulderConst);
	//	mConstraints.push_back(LArmConst);
	//	//mConstraints.push_back(RshoulderConst);
	//	//mConstraints.push_back(RArmConst);
	//	
	//}
	//else if (mArm == ArmType::LongArms)
	{
		//half height of legs
		Bone* LUpperArm = new Bone();
		Bone* RUpperArm = new Bone();
		Bone* LLowerArm = new Bone();
		Bone* RLowerArm = new Bone();

		//build shoulder piece
		//torso_width /= 2;
		mBuilder->SetDimensions(arm_Width, arm_height, mDepth * 0.5f);
		mBuilder->SetRelativePosition(Ogre::Vector3(((torso_width / 2) + arm_Width/2), 0, 0), Ogre::Quaternion::IDENTITY, *mShouldernode->GetNode());
		if (!mBuilder->BuildBone(*LUpperArm,Bone::BoneType::LUpperArm))
			return false;
		mBuilder->SetDimensions(arm_Width, arm_height, mDepth * 0.5f);
		mBuilder->SetRelativePosition(Ogre::Vector3(-((torso_width / 2) + arm_Width/2), 0, 0), Ogre::Quaternion::IDENTITY, *mShouldernode->GetNode());
		if (!mBuilder->BuildBone(*RUpperArm, Bone::BoneType::RUpperArm))
			return false;
		mBuilder->SetDimensions(arm_Width, arm_height, mDepth * 0.5f);
		mBuilder->SetRelativePosition(Ogre::Vector3(0, -(arm_height), 0), Ogre::Quaternion::IDENTITY, *LUpperArm->GetNode());
		if (!mBuilder->BuildBone(*LLowerArm, Bone::BoneType::LowerArm))
			return false;
		mBuilder->SetDimensions(arm_Width, arm_height, mDepth * 0.5f);
		mBuilder->SetRelativePosition(Ogre::Vector3(0, -(arm_height), 0), Ogre::Quaternion::IDENTITY, *RUpperArm->GetNode());
		if (!mBuilder->BuildBone(*RLowerArm, Bone::BoneType::LowerArm))
			return false;
		mBones.push_back(LUpperArm);
		mBones.push_back(RUpperArm);
		mBones.push_back(LLowerArm);
		mBones.push_back(RLowerArm);
		if (mHasMuscle)
		{
//.........这里部分代码省略.........
开发者ID:nathn123,项目名称:FYP,代码行数:101,代码来源:Skeleton_Builder.cpp


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