本文整理汇总了C++中VisBaseEntity_cl::SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ VisBaseEntity_cl::SetPosition方法的具体用法?C++ VisBaseEntity_cl::SetPosition怎么用?C++ VisBaseEntity_cl::SetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisBaseEntity_cl
的用法示例。
在下文中一共展示了VisBaseEntity_cl::SetPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
WaterSimulationController::WaterSimulationController(void)
{
#if defined(_VISION_ANDROID) //free camera for android (joystick/finger camera)
VisBaseEntity_cl* pCam = Vision::Game.CreateEntity("VFreeCamera", hkvVec3::ZeroVector());
pCam->SetPosition(-290, -220, 680); //spawns with same coordinates as windows
pCam->SetOrientation(20, 67, 19);
#endif
#if defined(WIN32)
VisBaseEntity_cl *pCamera = Vision::Game.SearchEntity("tankcamera");
Vision::Camera.AttachToEntity(pCamera, hkvVec3::ZeroVector());
#endif
/*#if defined(_VISION_ANDROID)
pMod = static_cast<vHavokPhysicsModule*>(vHavokPhysicsModule::GetInstance());
pMotionInput = (VMotionInputAndroid*)(&VInputManager::GetInputDevice(INPUT_DEVICE_MOTION_SENSOR));
pMotionInput->SetEnabled(true);
#endif*/
}
示例2: InitPhysics
void VLineFollowerComponent::InitPhysics(float fPathPos)
{
VisBaseEntity_cl* pOwner = (VisBaseEntity_cl *)GetOwner();
if (!pOwner)
return;
hkvVec3 vPos;
hkvVec3 vDir;
hkvAlignedBBox bbox;
m_fCurrentPathPos = fPathPos;
if(m_pFollowPath)
m_pFollowPath->EvalPoint(fPathPos, vPos, &vDir);
else
vPos = pOwner->GetPosition();
// to determine correct height on the ground, perform a ray-cast:
if (Vision::GetApplication()->GetPhysicsModule()!=NULL && Model_CapsuleHeight>0)
{
hkvVec3 vRayStart(vPos.x,vPos.y,vPos.z+Model_CapsuleHeight);
hkvVec3 vRayEnd(vPos.x,vPos.y,vPos.z-Model_CapsuleHeight);
VisPhysicsHit_t hitPoint;
if (Vision::GetApplication()->GetPhysicsModule()->Raycast(vRayStart, vRayEnd, hitPoint)) // hit?
{
vPos.z = hitPoint.vImpactPoint.z + 5.f*Vision::World.GetGlobalUnitScaling(); // add some margin
}
}
VDynamicMesh *pMesh = pOwner->GetMesh();
if (pMesh)
{
pMesh->GetCollisionBoundingBox(bbox);
vPos.z -= bbox.m_vMin.z;
// Use model size if not set
if (Model_CapsuleRadius<=0.f) Model_CapsuleRadius = hkvMath::Min( bbox.getSizeX(), bbox.getSizeY() )/2.f;
if (Model_CapsuleHeight<=0.f) Model_CapsuleHeight = bbox.getSizeZ();
} else
{
// No model - set some sane values if not set
if (Model_CapsuleRadius<=0.f) Model_CapsuleRadius = 40.f;
if (Model_CapsuleHeight<=0.f) Model_CapsuleHeight = 90.f;
}
// Create the physics object
pOwner->SetPosition(vPos);
if (!m_pPhys)
{
m_pPhys = new vHavokCharacterController();
m_pPhys->Capsule_Radius = Model_CapsuleRadius;
float h = Model_CapsuleHeight * 0.5f;
float fPivot = Model_GroundOffset;
m_pPhys->Character_Top.set(0, 0, h - fPivot);
m_pPhys->Character_Bottom.set(0, 0, -h - fPivot);
pOwner->AddComponent(m_pPhys);
}
// Update position
m_pPhys->SetPosition(vPos);
// Enable debug rendering
m_pPhys->SetDebugRendering(Debug_RenderMesh);
m_pPhys->SetDebugColor(V_RGBA_RED);
}