本文整理汇总了C++中VisBaseEntity_cl::AddComponent方法的典型用法代码示例。如果您正苦于以下问题:C++ VisBaseEntity_cl::AddComponent方法的具体用法?C++ VisBaseEntity_cl::AddComponent怎么用?C++ VisBaseEntity_cl::AddComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisBaseEntity_cl
的用法示例。
在下文中一共展示了VisBaseEntity_cl::AddComponent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddCube
VisBaseEntity_cl* IController::AddCube(float x, float y, float z) {
VisBaseEntity_cl *ent = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3(x, y, z), "Models\\Misc\\Cube.Model");
vHavokRigidBody *cube = new vHavokRigidBody();
cube->Havok_TightFit = true;
ent->AddComponent(cube);
//EntityStack stack = *entityStack;
//stack.push(ent);
entityStack->push(ent);
return ent;
}
示例2: AddRagdoll
VisBaseEntity_cl* IController::AddRagdoll(float x, float y, float z) {
VisBaseEntity_cl *ent = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3(x, y, z), "Models\\Warrior\\Warrior.model");
vHavokRagdoll *ragdoll = new vHavokRagdoll();
ragdoll->SetRagdollCollisionFile("Models\\Warrior\\WarriorRagdoll.hkt");
ent->AddComponent(ragdoll);
//EntityStack stack = *entityStack;
//stack.push(ent);
entityStack->push(ent);
return ent;
}
示例3: AddSphere
VisBaseEntity_cl* IController::AddSphere(float x, float y, float z) {
VisBaseEntity_cl *ent = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3(x, y, z), "Models\\Misc\\Sphere.Model");
vHavokRigidBody *sphere = new vHavokRigidBody();
sphere->Havok_TightFit = true;
sphere->Havok_Restitution = 1.0f;
ent->AddComponent(sphere);
//EntityStack stack = *entityStack;
//stack.push(ent);
entityStack->push(ent);
return ent;
}
示例4: vHavokRigidBody
//////////////////////////// Water Simulation Controls //////////////////////////////////////////////////////////////
VisBaseEntity_cl *IController::AddWaterDrop(float x, float y, float z, float scaling) {
VisBaseEntity_cl *ent = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3(x, y, z), "Assets\\Models\\Misc\\Sphere.Model");
ent->SetScaling(scaling);
vHavokRigidBody *sphere = new vHavokRigidBody();
sphere->Havok_TightFit = true;
sphere->Havok_Restitution = .35f;
ent->AddComponent(sphere);
ent->Tag();
entityStack->push(ent);
return ent;
}
示例5: RainBalls
void ParticleRainController::RainBalls(int numOfBalls){
while (ballCount < numOfBalls){
int randomx = rand() % 6000 - 3255;
int randomy = rand() % 6000 - 1416;
VisBaseEntity_cl *ent = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3(randomx, randomy, 3000), "Models\\Misc\\Sphere.Model");
vHavokRigidBody *ball = new vHavokRigidBody();
ball->Havok_TightFit = true;
ball->Havok_Mass = 5.0f;
ball->Havok_Restitution = 1.0f;
ball->Shape_Type = ShapeType_SPHERE;
ent->SetScaling(1.0f);
ent->AddComponent(ball);
++ballCount;
}
ballCount = 0;
}
示例6: Run
bool WaterSimulationController::Run(VInputMap* inputMap){
if(inputMap->GetTrigger(CUSTOM_CONTROL_ONE)){
VisBaseEntity_cl *ent = this->AddSphere(0, 0, 300);
ent->SetScaling(0.15f);
ent->RemoveAllComponents();
vHavokRigidBody *sphere = new vHavokRigidBody();
sphere->Havok_TightFit = true;
sphere->Havok_Restitution = 0.1f;
ent->AddComponent(sphere);
}
if(inputMap->GetTrigger(CUSTOM_CONTROL_TWO)){
TriggerBoxEntity_cl *triggerbox = vdynamic_cast <TriggerBoxEntity_cl *> (Vision::Game.SearchEntity("triggerbox"));
if(triggerbox->IsEnabled())
triggerbox->SetEnabled(false);
else if(!triggerbox->IsEnabled())
triggerbox->SetEnabled(true);
}
return true;
}
示例7: LookAtBox
static void LookAtBox(const hkvAlignedBBox &bbox)
{
if (!bbox.isValid())
return;
VisBaseEntity_cl* pCenterEntity = Vision::Game.CreateEntity("VisBaseEntity_cl", bbox.getCenter());
const float fBBRadius = bbox.getBoundingSphere().m_fRadius;
float fFovX, fFovY;
Vision::Contexts.GetMainRenderContext()->GetFinalFOV(fFovX, fFovY);
const float fDist = fBBRadius / hkvMath::tanDeg(hkvMath::Min(fFovX, fFovY) * 0.5f);
VOrbitCamera* pOrbitCamera = new VOrbitCamera();
pOrbitCamera->MinimalDistance = fDist * 0.01f;
pOrbitCamera->MaximalDistance = fDist * 100.0f;
pOrbitCamera->CameraDistance = fDist;
pCenterEntity->AddComponent(pOrbitCamera);
}
示例8: 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);
}