Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://mikelankamp.github.io/fpm/

https://github.com/GeeTwentyFive/fpmlinalg

https://github.com/GeeTwentyFive/GCollision

Usage

  1. GPhysics gp{};

  2. box = gp.AddBox(SIZE);

  3. gp.Tick();

Example

GPhysics gp{};

GPhysics::Box* floor = gp.AddBox({10, 1, 10});

GPhysics::Box* b1 = gp.AddBox({1, 1, 1});
b1->dynamic = true;
b1->aabb.SetCenterPos({0, 2, 0});

GPhysics::Box* b2 = gp.AddBox({1, 1, 1});
b2->dynamic = true;
b2->aabb.SetCenterPos({0, 5, 0});

for (int i = 0; i < (int)gp.tickrate; i++) {
        std::cout << std::endl;
        std::cout << "Tick: " << i << std::endl;
        std::cout << std::endl;

        fpmlinalg::Vec3 b1_pos = b1->aabb.GetCenterPos();
        std::cout << "Box 1 X: " << (float)b1_pos.x << std::endl;
        std::cout << "Box 1 Y: " << (float)b1_pos.y << std::endl;
        std::cout << "Box 1 Z: " << (float)b1_pos.z << std::endl;
        std::cout << std::endl;

        fpmlinalg::Vec3 b2_pos = b2->aabb.GetCenterPos();
        std::cout << "Box 2 X: " << (float)b2_pos.x << std::endl;
        std::cout << "Box 2 Y: " << (float)b2_pos.y << std::endl;
        std::cout << "Box 2 Z: " << (float)b2_pos.z << std::endl;
        std::cout << std::endl;

        gp.Tick();
}

About

Fixed-point header-only cross-platform-deterministic 3D AABB physics library

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages