本文整理汇总了C++中PhysicsObject::SetMass方法的典型用法代码示例。如果您正苦于以下问题:C++ PhysicsObject::SetMass方法的具体用法?C++ PhysicsObject::SetMass怎么用?C++ PhysicsObject::SetMass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhysicsObject
的用法示例。
在下文中一共展示了PhysicsObject::SetMass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnGameStateInitialized
/* INetworkClientListener methods */
void GameController::OnGameStateInitialized(ByteArrayInputStream &data)
{
//mLevel = new Level();
mInstance = std::shared_ptr<Instance>(new Instance());
mInstance->Unserialize(data);
mInstance->SetFlags(LevelFlagNoPhysicsUpdate);
mPlayer = new GameObject();
auto playerDataReq = CharacterData::GetPlayerCharacterById(mCharacter->GetId());
Model *model = new Model(mCharacter->GetModel());
model->SetActiveAnimation("idle");
mPlayer->AddComponent(new ModelComponent(mPlayer, model));
//mPlayer->RotateBy(glm::vec3(0, 180, 0));
mPlayer->Update(0);
auto shape = model->CreateBoundingVolume(kShapeTypeCapsule, glm::mat4());
//auto shape = new CapsuleShape(1.0, 1.0);
PhysicsObject *playerPhysics = new CharacterPhysicsObject(shape);
playerPhysics->SetMass(1);
//mPhysicsWorld->AddObject(playerPhysics);
mPlayer->AddComponent(new PhysicsComponent(mPlayer, playerPhysics));
playerDataReq.wait();
PlayerComponent *playerCharacter = new PlayerComponent(mPlayer, playerDataReq.get(), true);
mPlayer->AddComponent(playerCharacter);
mPlayer->AddComponent(new InstanceComponent(mPlayer, mInstance));
/* Register input listeners */
mInputListener = std::shared_ptr<InputListener>(new InputListener(mKeyMap));
MovementHandler *movementHandler = new MovementHandler(mPlayer, mCamera);
mInputListener->AddInputHandler(movementHandler);
TargetSelectHandler *targetHandler = new TargetSelectHandler(this);
targetHandler->SetListener(this);
mInputListener->AddInputHandler(targetHandler);
this->GetApplication()->AddKeyboardListener(mInputListener);
this->GetApplication()->AddMouseListener(mInputListener);
//this->LoadMap("molten_chasm.map");
/* Load GUI */
mPlayerFrame = new UnitFrameView(Point(100, 100), mPlayer);
this->GetView()->AddSubview(mPlayerFrame);
mTargetFrame = new UnitFrameView(Point(350, 100), NULL);
this->GetView()->AddSubview(mTargetFrame);
const Size& viewport = this->GetViewport();
mSpellBar = new SpellBarView(Size(WRAP_CONTENT, WRAP_CONTENT), mPlayer);
mSpellBar->AddSpellCastDelegate([this](SpellBarView *view, Spell *spell) {
this->OnSpellCast(view, spell);
});
mSpellBar->SetAlignParentBottom(true);
mSpellBar->SetAlignment(AlignmentCenterHorizontal);
mSpellBar->SetBottomMargin(50);
this->GetView()->AddSubview(mSpellBar);
mInputListener->AddInputHandler(mSpellBar);
PanelButtonBarView *panelButtonBar = new PanelButtonBarView();
panelButtonBar->SetPanelButtonListener(this);
this->GetView()->AddSubview(panelButtonBar);
Frame castBarFrame(0, 800, 300, 40);
castBarFrame.origin.x = (viewport.width * 0.5) - (castBarFrame.size.width * 0.5);
mPlayerCastBar = new CastBarView(castBarFrame);
mPlayerCastBar->SetVisibility(ViewInvisible);
this->GetView()->AddSubview(mPlayerCastBar);
Frame errorLabelFrame(0, 100, viewport.width, 50);
mErrorLabel = new LabelView(errorLabelFrame);
this->GetView()->AddSubview(mErrorLabel);
mSocialPanel = new SocialPanelView(mPlayer);
mSocialPanel->SetAlignment(AlignmentCenter);
mSocialPanel->SetVisibility(ViewInvisible);
this->GetView()->AddSubview(mSocialPanel);
mChatWindow = new ChatWindowView();
mChatWindow->SetAlignParentBottom(true);
mChatWindow->SetMargin(Rect(50, 0, 0, 50));
this->GetView()->AddSubview(mChatWindow);
// Give our player some buffs
STAT_STATUS_EFFECT_DESC desc;
desc.Target = mPlayer;
desc.Type = StatusEffectBuff;
//.........这里部分代码省略.........