void Grenade::InputHandling(){ timer+=Window->GetFrameTime(); if(timer>5){ exploding=true; if(!lim){ Explode.Play(); lim=true; ApplyForces(); } if(iter>2){ DestroyGrenade(); }else{ if(iter2>2){ Sprite sp; sp.SetImage(TOH->detonation[iter]); GrenadeSp=sp; GrenadeSp.SetScale(1+(0.5*iter),1+(0.5*iter)); GrenadeSp.SetCenter(60,65); iter++; iter2=0; }else{ iter2++; } } } GrenadeSp.SetPosition(grenadebody->GetPosition().x,grenadebody->GetPosition().y); if(!exploding)GrenadeSp.SetRotation(grenadebody->GetAngle()*-57.29577951308232); }
void CDM_FEA::Solve() //formulates and solves system! { RemoveDisconnected(); CalcDOF(); CalcBonds(); CalcStiffness(); //jmc: think it crashes here ApplyForces(); if (DOF != 0){ iparm[2] = -1; //sets to defualt system value... double ddum = 0; //Double dummy var int idum = 0; //Integer dummy var //msglvl = 0; //don't output info! phase = 13; // PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &DOF, a, ia, ja, &idum, &nrhs, iparm, &msglvl, b, x, &error, dparm); // F77_FUNC(PARDISO)(pt, &maxfct, &mnum, &mtype, &phase, &DOF, a, ia, ja, &idum, &nrhs, iparm, &msglvl, b, x, &error, dparm); F77_FUNC(pardiso)(pt, &maxfct, &mnum, &mtype, &phase, &DOF, a, ia, ja, &idum, &nrhs, iparm, &msglvl, b, x, &error, dparm); //if (error != 0) std::cout << "Pardiso error! (" << error << ") - Phase 1\n"; if (error == -1) std::cout << "Pardiso error: Input inconsistent\n"; else if (error == -2) std::cout << "Pardiso error: Not enough memory\n"; else if (error == -3) std::cout << "Pardiso error: Reodering Problem\n"; else if (error == -4) std::cout << "Pardiso error: Zero pivot, numerical factorization or iterative refinement problem\n"; else if (error == -10) std::cout << "Pardiso error: No License file Pardiso.lic found\n"; else if (error == -11) std::cout << "Pardiso error: License is expired\n"; else if (error == -12) std::cout << "Pardiso error: Wrong username or hostname\n"; phase = -1; /* Release internal memory. */ // PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &DOF, &ddum, ia, ja, &idum, &nrhs, iparm, &msglvl, &ddum, &ddum, &error, dparm); // F77_FUNC(PARDISO)(pt, &maxfct, &mnum, &mtype, &phase, &DOF, &ddum, ia, ja, &idum, &nrhs, iparm, &msglvl, &ddum, &ddum, &error, dparm); F77_FUNC(pardiso)(pt, &maxfct, &mnum, &mtype, &phase, &DOF, &ddum, ia, ja, &idum, &nrhs, iparm, &msglvl, &ddum, &ddum, &error, dparm); } //CalcMaxDisps(); FindMaxOverall(&Disp, x, MaxDisps); if (WantForces) CalcForces(); // OutputMatrices(); if (a != NULL) {delete [] a; a = NULL;} if (ia != NULL) {delete [] ia; ia = NULL;} if (ja != NULL) {delete [] ja; ja = NULL;} }
void FPhysSubstepTask::SubstepInterpolation(float InAlpha) { #if WITH_PHYSX #if WITH_APEX PxScene * PScene = PAScene->getPhysXScene(); #else PxScene * PScene = PAScene; #endif PhysTargetMap & Targets = PhysTargetBuffers[!External]; /** Note: We lock the entire scene before iterating. The assumption is that removing an FBodyInstance from the map will also be wrapped by this lock */ SCENE_LOCK_WRITE(PScene); for (PhysTargetMap::TIterator Itr = Targets.CreateIterator(); Itr; ++Itr) { FPhysTarget & PhysTarget = Itr.Value(); FBodyInstance* BodyInstance = Itr.Key(); PxRigidDynamic * PRigidDynamic = BodyInstance->GetPxRigidDynamic(); if (PRigidDynamic == NULL) { continue; } //We should only be iterating over actors that belong to this scene check(PRigidDynamic->getScene() == PScene); ApplyForces(PhysTarget, BodyInstance); ApplyTorques(PhysTarget, BodyInstance); InterpolateKinematicActor(PhysTarget, BodyInstance, InAlpha); } /** Final substep */ if (InAlpha >= 1.f) { Targets.Empty(Targets.Num()); } SCENE_UNLOCK_WRITE(PScene); #endif }