void VBlobShadowShader::UpdateShadow(const VBlobShadow *pShadow) { if (m_iShadowTexSampler>=0) { VStateGroupTexture *pStateGroupTexture = GetStateGroupTexture(VSS_PixelShader, m_iShadowTexSampler); if (pStateGroupTexture != NULL) pStateGroupTexture->m_spCustomTex = pShadow->GetShadowTexture(); } // update the uv projection planes const float fSizeX = pShadow->m_ShadowBox.getSizeX(); const float fSizeY = pShadow->m_ShadowBox.getSizeY(); hkvPlane planeU; planeU.m_vNormal = hkvVec3(1.f/fSizeX, 0, 0); planeU.m_fNegDist = -planeU.m_vNormal.dot (pShadow->m_ShadowBox.m_vMin); hkvPlane planeV; planeV.m_vNormal = hkvVec3(0, 1.f/fSizeY, 0); planeV.m_fNegDist = -planeV.m_vNormal.dot (pShadow->m_ShadowBox.m_vMin); GetConstantBuffer(VSS_VertexShader)->SetSingleRegisterF(m_iRegPlaneU, &planeU.m_vNormal.x); GetConstantBuffer(VSS_VertexShader)->SetSingleRegisterF(m_iRegPlaneV, &planeV.m_vNormal.x); // shadow color GetConstantBuffer(VSS_PixelShader)->SetSingleRegisterF(m_iRegColor, pShadow->m_vBlendColor.data); m_bModified = true; }
void vHavokPointToPlaneConstraintDesc::Reset() { vHavokConstraintDesc::Reset(); m_vPointToPlanePivot = hkvVec3(0.0f, 0.0f, 0.0f); m_vPlaneNormal = hkvVec3(0.0f, 0.0f, 1.0f); }
MergedModelFactory_cl::MergedModelFactory_cl() { m_pMergedModelEntity = NULL; m_pPreviewModelEntities = NULL; m_iModelsToMerge = 2; m_bArmArmor = false; m_bShoulderArmor = false; m_bLegsArmor = false; m_bKneeArmor = false; m_bAccessoire = false; m_bBelt = false; m_bCloth = false; m_bBeard = false; m_bAxe = true; m_vPos = hkvVec3(0.f, 0.f, 0.f); m_vOri = hkvVec3(0.f, 0.f, 0.f); m_pPlayerCamera = new VPlayerCamera(); m_pPlayerCamera->InitialYaw = 90.f; m_pPlayerCamera->RelativeLookAtHeight = 1.0f; m_pPlayerCamera->Follow = false; m_pPlayerCamera->Collides = false; m_pPlayerCamera->DepthOfField = true; #if defined( _VISION_MOBILE ) float fContentScaleFactor = Vision::Video.GetVideoConfig()->DisplayDensity; m_pPlayerCamera->CameraSensitivity /= fContentScaleFactor * 1.5f; #endif m_pCameraEntity = Vision::Game.CreateEntity( "VisBaseEntity_cl", hkvVec3(0.f, 0.f, 100.f), ""); m_pCameraEntity->AddComponent(m_pPlayerCamera); }
void Vehicle::CacheEntities() { hkvVec3 pos; if(this->automated){ pos = hkvVec3(100,100,100); } else{ pos = hkvVec3(-400,100,100); } m_chassis = Vision::Game.CreateEntity("VisBaseEntity_cl", pos, "Models\\DirtRacer.model"); m_chassis->AddComponent(new vHavokRigidBody()); VASSERT(m_chassis); if(!this->automated){ m_camera = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3(100,100,100)); VASSERT(m_camera); } //for (int wi = 0; wi < 4; wi ++) //{ // VString entityName; // entityName.Format("CruiserWheel%d", wi); // m_wheel[wi] = Vision::Game.SearchEntity(entityName); // VASSERT(m_wheel[wi]); //} //m_shadowLight = Vision::Game.SearchLightSource("CruiserShadow"); //VASSERT(m_shadowLight); //m_shadowLightOffset = m_shadowLight->GetRotationMatrix().transformDirection(hkvVec3(2500.0f, 0.0f, 0.0f)); }
void ConstraintVisualizer::RenderPrismaticBoxes (IVRenderInterface* pRenderer, const hkvVec3& vStartPos, const hkvVec3& vEndPos) { const VColorRef colorIB(0, 0, 200); const VColorRef colorOB(180, 180, 180); // Calculate the look at matrix hkvMat3 lookAtMat (hkvNoInitialization); lookAtMat.setLookInDirectionMatrix (vEndPos - vStartPos); // Compute box widths, so that they work for all world scales float fVecLen = (vStartPos - vEndPos).getLength(); const float fWidthIB = fVecLen / 100.0f; const float fWidthOB = fWidthIB * 2.0f; // Setup the two boxes hkvAlignedBBox bBoxInner (hkvVec3 (0, fWidthIB, fWidthIB), hkvVec3 (fVecLen/2, -fWidthIB, -fWidthIB)); hkvAlignedBBox bBoxOuter (hkvVec3 (fVecLen/2, fWidthOB, fWidthOB), hkvVec3 (fVecLen, -fWidthOB, -fWidthOB)); // Render the two bounding boxes VSimpleRenderState_t state(VIS_TRANSP_ALPHA, RENDERSTATEFLAG_FRONTFACE); hkvVec3 corners[8]; const hkvMat4 ThisIsALookAtMatrixYARLY (lookAtMat, vStartPos); bBoxInner.getCorners(corners); ThisIsALookAtMatrixYARLY.transformPositions(corners, 8); pRenderer->RenderBox(corners,sizeof(hkvVec3),colorIB,state); bBoxOuter.getCorners(corners); ThisIsALookAtMatrixYARLY.transformPositions(corners, 8); pRenderer->RenderBox(corners,sizeof(hkvVec3),colorOB,state); }
void VTerrainSectorRenderer::SetSector(VTerrainSector *pSector) { const VTerrainConfig &config(pSector->m_Config); m_pSector = pSector; const int iSx = m_pSector->m_iIndexX; const int iSy = m_pSector->m_iIndexY; const int iCountX = (config.m_iSectorCount[0] == 1) ? 1 : (((iSx > 0) && (iSx < config.m_iSectorCount[0] - 1)) ? 3 : 2); const int iCountY = (config.m_iSectorCount[1] == 1) ? 1 : (((iSy > 0) && (iSy < config.m_iSectorCount[1] - 1)) ? 3 : 2); m_spOwner->EnsureSectorRangeLoaded(hkvMath::Max(0, iSx-1), hkvMath::Max(0, iSy-1), iCountX, iCountY); m_pRenderLoop->SetSector(m_pSector); m_pRenderLoop->m_pTargetData = m_spTargetData; // save next time... float fDistance = 0.0f; const int iBaseX = hkvMath::Max(0, m_pSector->m_iIndexX - 1); const int iBaseY = hkvMath::Max(0, m_pSector->m_iIndexY - 1); for (int x = 0; x < iCountX; ++x) { for (int y = 0; y < iCountY; ++y) { VTerrainSector* pCurrentSector = m_pSector->GetSectorManager()->GetSector(iBaseX + x, iBaseY + y); fDistance = hkvMath::Max(fDistance, hkvMath::Max(config.m_vTerrainPos.z, pCurrentSector->m_fMaxHeightValue) - hkvMath::Min(config.m_vTerrainPos.z, pCurrentSector->m_fMinHeightValue)); } } // In case the terrain's sectors all have min/max height values of zero, a default distance of 100.0f is assumed. if (fDistance <= 0.0f) fDistance = 100.0f; hkvVec3 vCenter = m_pSector->GetSectorOrigin() + config.m_vSectorSize.getAsVec3(0.0f)*0.5f; vCenter.z = config.m_vTerrainPos.z + fDistance; hkvMat3 cameraMatrix (hkvNoInitialization); cameraMatrix.setLookInDirectionMatrix (hkvVec3(0, 0, -1), hkvVec3(0, 1, 0)); m_pCamera->Set(cameraMatrix,vCenter); const float fWidth = (float)(m_spTargetTex->GetTextureWidth()); const float fBorderWidth = ((config.m_vSectorSize.x * fWidth) / (fWidth - m_iBorderWidth*2)); const float fHeigth = (float)(m_spTargetTex->GetTextureHeight()); const float fBorderHeigth = ((config.m_vSectorSize.y * fHeigth) / (fHeigth - m_iBorderWidth*2)); m_spContext->GetViewProperties()->setOrthographicSize(fBorderWidth, fBorderHeigth); const float fNear = 0.0f; const float fFar = config.m_vTerrainPos.z + fDistance*2.0f; m_spContext->GetViewProperties()->setClipPlanes(fNear, fFar); m_pCamera->ReComputeVisibility(); }
void VParticleWallmark::InflateBoundingBox(hkvAlignedBBox &bbox) { hkvVec3 vDist(distortion[0],distortion[1],distortion[2]); float fRadius = vDist.getLength(); fRadius = hkvMath::Max(fRadius,size); hkvAlignedBBox thisBox(hkvVec3 (pos[0]-fRadius,pos[1]-fRadius,pos[2]-fRadius), hkvVec3 (pos[0]+fRadius,pos[1]+fRadius,pos[2]+fRadius)); bbox.expandToInclude(thisBox); }
// ---------------------------------------------------------------------------- void vHavokPointToPathConstraintDesc::Reset() { vHavokConstraintDesc::Reset(); m_vPathPivot = hkvVec3(0.0f, 0.0f, 0.0f); m_vPathDirection = hkvVec3(1.0f, 0.0f, 0.0f); m_fPathLength = 0.0f; m_fFriction = 0.0f; }
VDecorationCollisionPrimitive* VTerrainDecorationEntityModel::GetCollisionSubObject(int iIndex) { VASSERT(iIndex==0 && m_Properties.m_fCollisionCapsuleRadius>0.f); // The lower end should stick into the ground, the upper half-sphere should be inside the bounding box - if possible float fUpper = m_LocalBBox.m_vMax.z - m_Properties.m_fCollisionCapsuleRadius; float fLower = m_LocalBBox.m_vMin.z; if (fUpper<fLower) fUpper=fLower; m_CollisionCapsule.Set(hkvVec3(0,0,fLower), hkvVec3(0,0,fUpper), m_Properties.m_fCollisionCapsuleRadius); return &m_CollisionCapsule; }
// ---------------------------------------------------------------------------- void vHavokConstraintDesc::Reset() { m_spBodies[0] = NULL; m_spBodies[1] = NULL; m_vPivots[0] = hkvVec3(0, 0, 0); m_vPivots[1] = hkvVec3(0, 0, 0); m_bBreakable = false; m_fBreakThreshold = 1000.f; m_bRevertVelocityOnBreak = false; m_bMalleable = false; m_fConstraintStrength = 1.f; }
void Vehicle::UpdateWheels() { if (m_instance == HK_NULL) return; for (int wi = 0; wi < 4; wi ++) { if (m_wheel[wi] != NULL) { hkVector4 pos; hkQuaternion rot; m_instance->calcCurrentPositionAndRotation(m_instance->getChassis(), m_instance->m_suspension, wi, pos, rot); rot.normalize(); hkTransform trans(rot, pos); // Convert to Vision space hkvVec3 position; hkvMat3 rotation; vHavokConversionUtils::PhysTransformToVisMatVec(trans, rotation, position); // Update wheel entity m_wheel[wi]->SetPosition(position); // Rotate the wheels on the left hand side of the car 180 degrees so their model is facing the right way if (wi % 2 == 1) { hkvMat3 flipWheelMatrix; flipWheelMatrix.setRotationMatrix(hkvVec3(1,0,0), 180.f); rotation = rotation.multiply(flipWheelMatrix); } m_wheel[wi]->SetRotationMatrix(rotation); } } }
void VPathRenderingData::RemoveLinkRoll(hkvMat3 const& mPrevRot, hkvMat3& mRot, bool& bDirection) const { hkvMat3 mPrevRotInv(mPrevRot); VVERIFY(mPrevRotInv.invert() == HKV_SUCCESS); // Calculate the rotation of the current link in the space of the // previous link hkvMat3 mThisInPrev = mPrevRotInv.multiply(mRot); // Check whether we are changing direction (that is, we have a sharp angle // between two links). In this case, we need to change how we adjust the roll. hkvVec3 v2(mThisInPrev * hkvVec3(1, 0, 0)); bool bChangingDirection = bDirection ? v2[0] > 0 : v2[0] < 0; if (bChangingDirection) bDirection = !bDirection; // Adjust the roll component float rgfThisInPrev[3]; mThisInPrev.getAsEulerAngles(rgfThisInPrev[2], rgfThisInPrev[1], rgfThisInPrev[0]); if (bDirection) rgfThisInPrev[2] = 180.f; else rgfThisInPrev[2] = 0.f; mRot.setFromEulerAngles(rgfThisInPrev[2], rgfThisInPrev[1], rgfThisInPrev[0]); // Transform back to global space mRot = mPrevRot.multiply(mRot); }
///\brief ///Evaluates the bounding box of the capsule inline void GetBoundingBox(hkvAlignedBBox &dest) { dest.m_vMin = m_vStartPosition; dest.m_vMax = m_vStartPosition; dest.expandToInclude(m_vStartPosition+m_vDirection*GetLength()); dest.addBoundary (hkvVec3 (GetRadius())); }
hkvVec3 mArea::TopLeft() { float X = (startPoint.x >= endPoint.x) ? endPoint.x : startPoint.x; float Y = (startPoint.y >= endPoint.y) ? startPoint.y : endPoint.y; return hkvVec3(X,Y,0); }
hkvVec3 mArea::BottomRight() { float X = (startPoint.x >= endPoint.x) ? startPoint.x : endPoint.x; float Y = (startPoint.y >= endPoint.y) ? endPoint.y : startPoint.y; return hkvVec3(X,Y,0); }
// ---------------------------------------------------------------------------- void vHavokRagdollConstraintDesc::Reset() { vHavokConstraintDesc::Reset(); m_vPivot = hkvVec3::ZeroVector (); m_vTwistAxis = hkvVec3(1.f, 0.f, 0.f); m_vPlaneAxis = hkvVec3(0.f, 1.f, 0.f); m_fConeAngle = hkvMath::pi () / 4.f; m_fPlaneConeMinAngle = -hkvMath::pi () / 4.f; m_fPlaneConeMaxAngle = hkvMath::pi () / 4.f; m_fTwistMinAngle = -hkvMath::pi (); m_fTwistMaxAngle = hkvMath::pi (); m_bConeLimitStabilization = false; m_fMaxFrictionTorque = 0.f; m_fAngularLimitsTauFactor = 0.8f; m_fConeAngle = hkvMath::pi ()*0.5f; }
void Vehicle::CacheEffects() { VisParticleEffectFile_cl* fxDustTrail = VisParticleGroupManager_cl::GlobalManager().LoadFromFile("Particles\\Car_DustTrail_Sand_SingleTire.xml"); VASSERT(fxDustTrail); VisParticleEffectFile_cl* fxTyreMark = VisParticleGroupManager_cl::GlobalManager().LoadFromFile("Particles\\Car_Tyremark_Sand.xml"); VASSERT(fxTyreMark); for (int wi = 0; wi < 4; wi ++) { m_wheelFX[wi] = fxDustTrail->CreateParticleEffectInstance(hkvVec3(0.f, 0.f, 0.f), hkvVec3(0.f, 0.f, 0.f), 1.0f); m_tyremarkFX[wi] = fxTyreMark->CreateParticleEffectInstance(hkvVec3(0.f, 0.f, 0.f), hkvVec3(0.f, 0.f, 0.f), 1.0f); // Tweak the particle color m_wheelFX[wi]->SetAmbientColor(VColorRef(75, 75, 75, 255)); m_tyremarkFX[wi]->SetAmbientColor(VColorRef(75, 75, 75, 255)); } }
// ---------------------------------------------------------------------------- void vHavokPulleyConstraintDesc::Reset() { vHavokConstraintDesc::Reset(); m_vPulleyPivots[0] = m_vPulleyPivots[1] = hkvVec3(0.0f, 0.0f, 0.0f); m_fLeverage = 0.0f; m_fRopeLength = 0.0f; }
void RPG_InventoryHandler::DebugDisplayInventory() { const float verticalOffset = 350.f; //@todo: Get the character's height here & replace offset magic number VString msg, tempLine; //@todo: Is there a less crufty way to build these strings? // add inventory list for (int i = 0; i < m_inventoryCollection.Count (); ++i) { tempLine.Format("Item #%i - %s\n", i, m_inventoryCollection.GetAt(i)->GetName().AsChar()); msg += tempLine; } tempLine.Format("Equipped:\n"); msg += tempLine; // add equipped weapon info if (GetEquippedWeapon()) { tempLine.Format("Equipped weapon: %s (Dmg: %.1f%%%% - %.1f%%%%, Spd: %.1f%%%%, Rng: %.1f)\n", GetEquippedWeapon()->GetName().AsChar(), GetEquippedWeapon()->GetMinDamage(), GetEquippedWeapon()->GetMaxDamage(), GetEquippedWeapon()->GetSpeed(), GetEquippedWeapon()->GetRange() ); } else { tempLine.Format("Equipped weapon: None\n"); } msg += tempLine; // add equipped armor info tempLine.Format("Equipped armor: %s (%i), %s (%i), %s (%i),\n %s (%i), %s (%i), %s (%i)\n", GetEquippedArmor(ES_Helmet) ? GetEquippedArmor(ES_Helmet)->GetName().AsChar() : "<None>", GetEquippedArmor(ES_Helmet) ? GetEquippedArmor(ES_Helmet)->GetArmorValue() : 0, GetEquippedArmor(ES_Chest) ? GetEquippedArmor(ES_Chest)->GetName().AsChar() : "<None>", GetEquippedArmor(ES_Chest) ? GetEquippedArmor(ES_Chest)->GetArmorValue() : 0, GetEquippedArmor(ES_Gloves) ? GetEquippedArmor(ES_Gloves)->GetName().AsChar() : "<None>", GetEquippedArmor(ES_Gloves) ? GetEquippedArmor(ES_Gloves)->GetArmorValue() : 0, GetEquippedArmor(ES_Shoulder) ? GetEquippedArmor(ES_Shoulder)->GetName().AsChar() : "<None>", GetEquippedArmor(ES_Shoulder) ? GetEquippedArmor(ES_Shoulder)->GetArmorValue() : 0, GetEquippedArmor(ES_Belt) ? GetEquippedArmor(ES_Belt)->GetName().AsChar() : "<None>", GetEquippedArmor(ES_Belt) ? GetEquippedArmor(ES_Belt)->GetArmorValue() : 0, GetEquippedArmor(ES_Boots) ? GetEquippedArmor(ES_Boots)->GetName().AsChar() : "<None>", GetEquippedArmor(ES_Boots) ? GetEquippedArmor(ES_Boots)->GetArmorValue() : 0 ); msg += tempLine; // display the message const hkvVec3 vPos = m_characterOwner->GetPosition() + hkvVec3(0.0f, 0.0f, verticalOffset); Vision::Message.DrawMessage3D(msg, vPos); }
void VLineFollowerComponent::CommonInit() { StartAnimation(Model_AnimationName); if (m_pPhys) m_pPhys->SetDebugRendering(Debug_RenderMesh); m_mDeltaRotation.setRotationMatrix (hkvVec3(0,0,1), Model_DeltaRotation); }
EngineInstanceFmodCollisionMesh::EngineInstanceFmodCollisionMesh() { m_bIsVisible = true; m_bSelected = false; m_pEntity = Vision::Game.CreateEntity("VisBaseEntity_cl", hkvVec3(0.0f,0.0f,0.0f), NULL); m_pStaticMeshInst = NULL; m_pMeshInstance = new VFmodCollisionMeshInstance(); m_pEntity->AttachToParent(m_pMeshInstance); // move with it }
// ---------------------------------------------------------------------------- void vHavokHingeConstraintDesc::Reset() { vHavokConstraintDesc::Reset(); m_vHingePivot = hkvVec3::ZeroVector (); m_vRotAxis = hkvVec3(1.f, 0.f, 0.f); m_bUseLimits = false; m_fAngleMin = -180.f; m_fAngleMax = 180.f; }
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; }
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; }
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; }
VisBaseEntity_cl* RPG_GameManager::SpawnPlayer(const VString& prefabName) { VisBaseEntity_cl* entity = NULL; if(m_levelInfo) { RPG_PlayerSpawnPoint* playerSpawnPoint = m_levelInfo->GetInitialPlayerSpawnPoint(); if(playerSpawnPoint) { entity = CreateEntityFromPrefab(prefabName, playerSpawnPoint->GetPosition(), playerSpawnPoint->GetOrientation()); } else { entity = CreateEntityFromPrefab(prefabName, hkvVec3(0.0f, 0.0f, 0.0f), hkvVec3(0.0f, 0.0f, 0.0f)); } } return entity; }
//////////////////////////// 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; }
void VFpsCameraEntity::UpdateCharacterController() { if (m_pCharacterController == NULL) return; const float fActualStandHeight = hkvMath::Max(m_fHeight, m_fEyeHeight); const float fActualRadius = hkvMath::Min(m_fRadius, fActualStandHeight * 0.5f); m_pCharacterController->Capsule_Radius = fActualRadius; m_pCharacterController->Character_Top = hkvVec3(0.0f, 0.0f, fActualStandHeight - m_fEyeHeight); m_pCharacterController->Character_Bottom = hkvVec3(0.0f, 0.0f, -m_fEyeHeight); m_pCharacterController->Step_Height = fActualStandHeight / 3.0f; m_pCharacterController->Jump_Height = (fActualStandHeight / 3.0f) * vHavokConversionUtils::GetVision2HavokScale(); // Re-create the Havok Physics controller if it was already initialized. if (m_pCharacterController->GetCharacterProxy() != NULL) { m_pCharacterController->DeleteHavokController(); m_pCharacterController->CreateHavokController(); } }
void VLineFollowerComponent::PerFrameUpdate() { VisBaseEntity_cl* pOwner = (VisBaseEntity_cl *)GetOwner(); if (!pOwner || !m_pFollowPath) return; hkvVec3 vPos; hkvVec3 vDir; m_pFollowPath->EvalPoint(m_fCurrentPathPos, vPos, &vDir); vPos.z = pOwner->GetPosition().z; float fDiff = Vision::GetTimer()->GetTimeDifference(); if((vPos - pOwner->GetPosition()).getLength() < Path_TriggerDistance) { if(fDiff>0.1) m_fCurrentPathPos += (3/Path_NumberSteps); else m_fCurrentPathPos += (1/Path_NumberSteps); if (m_fCurrentPathPos>1.f) { if (m_pFollowPath->IsClosed()) m_fCurrentPathPos = hkvMath::mod (m_fCurrentPathPos,1.f); else m_fCurrentPathPos = 1.f; } m_pFollowPath->EvalPoint(m_fCurrentPathPos, vPos, &vDir); vPos.z = pOwner->GetPosition().z; if(Vision::Editor.IsAnimatingOrPlaying() && Debug_DisplayBoxes) Vision::Game.DrawCube(vPos,80.f); } else { if(Vision::Editor.IsAnimatingOrPlaying() && Debug_DisplayBoxes) Vision::Game.DrawCube(vPos,80.f,V_RGBA_YELLOW); } // Orient the entity in the right direction hkvMat3 mRot(hkvNoInitialization); mRot.setLookInDirectionMatrix (vPos - pOwner->GetPosition()); mRot = mRot.multiply (m_mDeltaRotation); pOwner->SetRotationMatrix(mRot); // The animation we are playing should have motion delta which will // move towards the target position. No animation, well lets add at // least some motion delta if (!m_bPlayingAnim) { pOwner->SetMotionDeltaLocalSpace( hkvVec3(1.f,0.f,0.f)*(Model_CapsuleRadius*fDiff) ); } }
// ---------------------------------------------------------------------------- void vHavokConstraintChainDesc::Reset() { m_spAnchorBodies[0] = NULL; m_spAnchorBodies[1] = NULL; m_vAnchorPivots[0] = hkvVec3(0, 0, 0); m_vAnchorPivots[1] = hkvVec3(0, 0, 0); m_fLinkLength = 10.f; m_fLinkGap = 0.f; m_fDiameter = 1.0f; m_fMaterialDensity = 1.0f * 1e3f; m_fMaterialStretchingConstant = 1.0f * 1e9f; m_fChainDamping = 1.0f; m_fLinkLinearDamping = 0.1f; m_fLinkAngularDamping = 0.1f; m_bCalculateLinkInertia = false; m_vInertiaTensorAxisScaling.set (1.0f); m_fInertiaTensorUniformScaling = 1.f; m_iLinkCollisionGroup = 0; m_iLinkCollisionLayer = 0; m_iLinkSubSystemId = 0; m_iLinkSubSystemDontCollideWith = 0; m_bComputeCfm = false; m_fCfmFactor = 1.f; m_fFixedCfm = 0.0001f; m_bUseAngularFriction = false; m_fFrictionFactorMin = 0.3f; m_fFrictionFactorMax = 30.f; m_fBaseTension = 0.f; if (m_pszPathKey) V_SAFE_STRFREE(m_pszPathKey); }