本文整理汇总了C++中Sprite3D::getPositionZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite3D::getPositionZ方法的具体用法?C++ Sprite3D::getPositionZ怎么用?C++ Sprite3D::getPositionZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite3D
的用法示例。
在下文中一共展示了Sprite3D::getPositionZ方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eye
void WTest3D::showSprite3D()
{
//the assets are from the OpenVR demo
//get the visible size.
Size size = Director::getInstance()->getVisibleSize();
float zeye = Director::getInstance()->getZEye();
Vec3 eye(size.width / 2, size.height / 2.0f, zeye),
center(size.width / 2, size.height / 2, 0.0f),
up(0.0f, 1.0f, 0.0f);
_camera = Camera::createPerspective(60, size.width / size.height, 100, 3000);// zeye + size.height / 2.0f);
_camera->setCameraFlag(CameraFlag::USER1);
//_camera->setPosition3D(Vec3(0, 25, 15));
_camera->setPosition3D(eye + Vec3(0, 60, 10));
//_camera->lookAt(center, up);
//_camera->setRotation3D(Vec3(-35, 0, 0));
//auto LightMapScene = Sprite3D::create("Sprite3DTest/boss1.obj");
//LightMapScene->setTexture("Sprite3DTest/boss.png");
//auto LightMapScene = Sprite3D::create("Sprite3DTest/aaaa.c3b");
addChild(_camera);
setCameraMask(2);
std::string fileName = "Sprite3DTest/orc.c3b";
//std::string fileName = "Sprite3DTest/cccc.c3b";
for (int i = 0; i < 14; ++i)
{
auto LightMapScene = Sprite3D::create(fileName);
LightMapScene->setScale(8);
addChild(LightMapScene, 100 + i, 100 + i);
LightMapScene->setRotation3D(Vec3(0, 180, 0));
auto sc = LightMapScene->getScale();
auto sz = LightMapScene->getContentSize();
auto curY = _terrain->getHeight(Vec2(250 + i*(sc*sz.width - 150), 10));
LightMapScene->setPosition3D(Vec3(250 + i*(sc*sz.width - 150), curY, 10));
}
for (int i = 0; i < 14; ++i)
{
auto LightMapScene = Sprite3D::create(fileName);
LightMapScene->setScale(8);
addChild(LightMapScene, 200 + i, 200 + i);
LightMapScene->setRotation3D(Vec3(0, 0, 0));
auto sc = LightMapScene->getScale();
auto sz = LightMapScene->getContentSize();
auto curY = _terrain->getHeight(Vec2(250 + i*(sc*sz.width - 150), -1500));
LightMapScene->setPosition3D(Vec3(250 + i*(sc*sz.width - 150), curY, -1500));
}
for (int i = 0; i < 14; ++i)
{
auto LightMapScene = Sprite3D::create(fileName);
LightMapScene->setScale(8);
addChild(LightMapScene, 300 + i, 300 + i);
LightMapScene->setRotation3D(Vec3(0, 90, 0));
auto sc = LightMapScene->getScale();
auto sz = LightMapScene->getContentSize();
auto curY = _terrain->getHeight(Vec2(20, -400 - i * 80));
LightMapScene->setPosition3D(Vec3(20, curY, -400 - i * 80));
}
for (int i = 0; i < 14; ++i)
{
auto LightMapScene = Sprite3D::create(fileName);
LightMapScene->setScale(8);
addChild(LightMapScene, 400 + i, 400 + i);
LightMapScene->setRotation3D(Vec3(0, 270, 0));
auto sc = LightMapScene->getScale();
auto sz = LightMapScene->getContentSize();
auto curY = _terrain->getHeight(Vec2(1200, -400 - i * 80));
LightMapScene->setPosition3D(Vec3(1200, curY, -400 - i * 80));
}
//for (int i = 0; i < 10; ++i)
//{
// auto LightMapScene = Sprite3D::create(fileName);
// LightMapScene->setScale(8);
// addChild(LightMapScene, i, i);
// LightMapScene->setRotation3D(Vec3(90, 180, 0));
// auto sc = LightMapScene->getScale();
// auto sz = LightMapScene->getContentSize();
// CCLOG("getContentSize().width = %f, getContentSize().height = %f",
// getContentSize().width, getContentSize().height);
// LightMapScene->setPosition3D(Vec3(200 + i*(sc*sz.width - 150), 100, -300));
//}
Sprite3D* temp = (Sprite3D*)getChildByTag(100 + 13);
CCLOG("getPositionX() = %f, getPositionY() = %f, getPositionZ = %f",
temp->getPositionX(), temp->getPositionY(), temp->getPositionZ());
CCLOG("getScaleX() = %f, getScaleX() = %f, getScaleZ = %f",
temp->getScaleX(), temp->getScaleY(), temp->getScaleZ());
CCLOG("getContentSize().width = %f, getContentSize().height = %f",
temp->getContentSize().width, temp->getContentSize().height);
CCLOG("getAnchorPoint().x = %f, getAnchorPoint().y = %f",
temp->getAnchorPoint().x, temp->getAnchorPoint().y);
//actions
//.........这里部分代码省略.........