TorqueD.dpr 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. (* This is a basic use for TGLBInertia behaviour.
  2. There are three objects, which we assign three different dampings, and we
  3. apply a torque to the object under the mouse pointer, other are left along
  4. with their inertia (and damping makes them progressively reduce their speed).
  5. There is also a checkbox to double the objects mass.
  6. Notice how the constant damping stops abruptly the dodecahedron, while the
  7. the octahedron, once spinned, is slowing down but never really stops.
  8. However, don't show this sample to your science teacher, since our "torque"
  9. is actually an angular acceleration in degrees that gets affected by the
  10. object's mass... Anyway, it looks like a real torque is applied.
  11. Note that the inertia behaviour could have been accessed directly with a
  12. TGLBInertia(Behaviours[0]) for all objects in this sample, but using the
  13. helper function GetOrCreateInertia is a more convenient (and resilient) way,
  14. since it will automatically add an inertia behaviour to our object if it
  15. doesn't have one.
  16. *)
  17. program TorqueD;
  18. uses
  19. Forms,
  20. fTorqueD in 'fTorqueD.pas' {FormTorque};
  21. {$R *.RES}
  22. begin
  23. Application.Initialize;
  24. Application.CreateForm(TFormTorque, FormTorque);
  25. Application.Run;
  26. end.