Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (auto pChopper = player->QueryInterface<ISimpleChopper>())
- {
- auto ClearEdges = []()
- {
- using namespace Superheated;
- using speed::Vector3;
- WCollisionPack** pPacks = *(WCollisionPack***)0x9B38A0;
- for (int i = 0; i < 0xA8C; i++)
- {
- if (!pPacks[i]) continue;
- for (unsigned int j = 0; j < pPacks[i]->mInstanceNum; j++)
- {
- CARPCollisionInstance& obj = pPacks[i]->mInstanceList[j];
- Vector3 pos = Vector3(-obj.fInvPosRadius.x, -obj.fInvPosRadius.y, -obj.fInvPosRadius.z);
- if (obj.fCollisionArticle->fNumEdges)
- {
- obj.fCollisionArticle->fIntermediatObjInd = obj.fCollisionArticle->fNumEdges | 0b100000000000000;
- obj.fCollisionArticle->fNumEdges = 0;
- }
- }
- }
- };
- ClearEdges();
- auto pRigidBody = player->QueryInterface<IRigidBody>();
- auto deltaTime = ImGui::GetIO().DeltaTime;
- auto pCollisionBody = player->QueryInterface<ICollisionBody>();
- static float mSpeed = 0.f;
- bool wPressed = is_down('W');
- bool aPressed = is_down('A');
- bool sPressed = is_down('S');
- bool dPressed = is_down('D');
- auto lerpVec3 = [](const auto& v1, const auto& v2, auto t)
- {
- auto lerp = [](auto a, auto b, auto t)
- {
- return ((a)+(t) * ((b)-(a)));
- };
- return lm::Vec3{
- lerp(v1.x, v2.x, t),
- lerp(v1.y, v2.y, t),
- lerp(v1.z, v2.z, t)
- };
- };
- if (wPressed)
- mSpeed += deltaTime * 5;
- else
- mSpeed -= deltaTime;
- if (mSpeed < 0.f)
- mSpeed = 0.f;
- lm::Vec3 fvec = pCollisionBody->GetForwardVector();
- lm::Vec3 rvec = pCollisionBody->GetRightVector();
- lm::Vec3 rotated;
- auto vec = fvec;
- if (aPressed)
- rotated = lerpVec3(fvec, rvec * -1.f, deltaTime * 5);
- if (dPressed)
- rotated = lerpVec3(fvec, rvec, deltaTime * 5);
- if (aPressed || dPressed)
- vec = rotated;
- if (wPressed || aPressed || dPressed)
- pChopper->SetDesiredFacingVector(vec);
- if (wPressed)
- vec *= mSpeed;
- if (sPressed)
- vec *= -1.f;
- if (is_down(VK_UP))
- vec.y = 10.f;
- if (is_down(VK_DOWN))
- vec.y = -7.5f;
- pChopper->SetDesiredVelocity(vec);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement