Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. extern crate newton_dynamics as newton;
  2.  
  3. use newton::NewtonWorld;
  4. use newton::collision::NewtonBox;
  5.  
  6. trait NewtonCollision {
  7. fn body(&self) -> NewtonBody;
  8. }
  9.  
  10. trait NewtonData {
  11. type Vector3;
  12. type Vector4;
  13. type Quaternion;
  14. type Matrix4;
  15. }
  16.  
  17. fn main() {
  18. // create a new world
  19. let world: NewtonWorld<Q> = NewtonWorld::new();
  20.  
  21. // Api that
  22. let floor = NewtonBox::new(&world, 16.0, 0.2, 16.0, None);
  23. let cube = NewtonBox::new(&world, 1.0, 1.0, 1.0, None);
  24.  
  25. // Create new bodies from the cuboid shape
  26. let floor_body: NewtonBody<_> = cube.body(Matrix::identity());
  27. let cube_body: NewtonBody<_> = cube.body(1.0, Matrix::translate(0.0, 4.0, 0.0));
  28.  
  29. cube_a.compute_mass(&cube);
  30.  
  31. // compute mass matrix
  32. cube.compute_mass(&cube);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement