fOdeMachineC.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // ---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "fOdeMachineC.h"
  5. // ---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "GLS.BaseClasses"
  8. #pragma link "GLS.BitmapFont"
  9. #pragma link "GLS.Cadencer"
  10. #pragma link "GLS.Coordinates"
  11. #pragma link "GLS.GeomObjects"
  12. #pragma link "GLS.HUDObjects"
  13. #pragma link "GLS.Objects"
  14. #pragma link "Physics.ODEManager"
  15. #pragma link "GLS.Scene"
  16. #pragma link "GLS.SceneViewer"
  17. #pragma link "GLS.WindowsFont"
  18. #pragma resource "*.dfm"
  19. TForm1 *Form1;
  20. // ---------------------------------------------------------------------------
  21. __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {
  22. TAffineVector av = {-250, 0, 0};
  23. ((TGLODEDynamic*)Pin2->Behaviours->Items[0])->AddForce(av);
  24. }
  25. // ---------------------------------------------------------------------------
  26. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender,
  27. TMouseButton Button, TShiftState Shift, int X, int Y) {
  28. my = Y;
  29. mx = X;
  30. }
  31. // ---------------------------------------------------------------------------
  32. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender,
  33. TShiftState Shift, int X, int Y) {
  34. if (Shift.Contains(ssShift))
  35. GLCamera1->MoveAroundTarget(my - Y, mx - X);
  36. my = Y;
  37. mx = X;
  38. }
  39. // ---------------------------------------------------------------------------
  40. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender,
  41. const double deltaTime, const double newTime) {
  42. GLODEManager1->Step(deltaTime);
  43. /*
  44. PdVector3 velWheel = dBodyGetAngularVel(TGLODEDynamic(Wheel->Behaviours)->Body);
  45. PdVector3 velPin2 = dBodyGetLinearVel(TGLODEDynamic(Pin2->Behaviours[0])->Body);
  46. GLHUDText1->Text = Format(
  47. "Wheel Angular Velocity (Y-Axis) = %.1f\r\
  48. Pin2 Linear Velocity (X-Axis) = %.1f",
  49. ARRAYOFCONST((velWheel[1], velPin2[0])));
  50. */
  51. }
  52. // ---------------------------------------------------------------------------