Reference Codebot.Physics.pas
Part of the Codebot Render package
The Codebot.Physics unit makes the Chipmunk2D physics library easy to use from Pascal by wrapping it in records.
| Record | Description |
|---|---|
| TSpace | The simulated world, with its gravity, bodies, shapes, and joints. |
| TBody | A rigid body in a space, with its position, angle, velocity, and mass. |
| TShape | Gives a body its shape. TCircle, TSegment, and TPolygon are its kinds. |
| TJoint | Connects two bodies. TPinJoint, TSlideJoint, TPivotJoint, TGrooveJoint, TDampedSpringJoint, TDampedRotarySpringJoint, TRotaryLimitJoint, TRatchetJoint, TGearJoint, and TMotorJoint are its kinds. |
| TArbiter | Describes a collision between two shapes. |
Each record is the same pointer Chipmunk2D uses, so the records convert freely to and from the routines of Codebot.Interop.Chipmunk2D, and Chipmunk2D manages everything itself without anything being duplicated in Pascal. The records add properties, methods such as Space.NewBody.NewCircle(20), and for in loops over the bodies, shapes, and joints of a space.
The unit also gives you routines that compute the moment, area, and centroid of shapes, and that build convex hulls and polylines.
Items 424 items
| Name | Kind | Line |
|---|---|---|
| AreaForCircle | function | 107 |
| AreaForPolygon | function | 111 |
| AreaForSegment | function | 108 |
| bodyDynamic | constant | 134 |
| bodyKinematic | constant | 135 |
| bodyStatic | constant | 136 |
| BoolFlags | constant | 81 |
| CentroidForPolygon | function | 113 |
| ClosestPointOnSegment | function | 118 |
| collideGrab | constant | 88 |
| ConvexHull | function | 116 |
| FilterAll | constant | 84 |
| MaskAll | constant | 82 |
| MaskToStr | function | 91 |
| MatrixIdentity | constant | 80 |
| MomentForBox | function | 105, 106 |
| MomentForCircle | function | 99, 100 |
| MomentForPolygon | function | 102, 103 |
| MomentForSegment | function | 101 |
| NewSpace | function | 1439 |
| shapeCircle | constant | 125 |
| shapePolygon | constant | 127 |
| shapeSegment | constant | 126 |
| StrToMask | function | 93 |
| TArbiter | record | 825 |
| Ref | field | 827 |
| CallWildcardBeginA | function | 864 |
| CallWildcardBeginB | function | 865 |
| CallWildcardPostSolveA | procedure | 868 |
| CallWildcardPostSolveB | procedure | 869 |
| CallWildcardPreSolveA | function | 866 |
| CallWildcardPreSolveB | function | 867 |
| CallWildcardSeparateA | procedure | 870 |
| CallWildcardSeparateB | procedure | 871 |
| GetBodies | procedure | 857 |
| GetShapes | procedure | 855 |
| Ignore | function | 853 |
| Implicit | operator | 828, 829 |
| IsFirstContact | function | 859 |
| IsNil | function | 850 |
| IsRemoval | function | 861 |
| ContactPointSet | property | 883 |
| Count | property | 885 |
| Depth | property | 892 |
| Friction | property | 877 |
| Normal | property | 887 |
| PointA | property | 889 |
| PointB | property | 890 |
| Restitution | property | 874 |
| SurfaceVelocity | property | 879 |
| TotalImpulse | property | 895 |
| TotalKineticEnergy | property | 897 |
| UserData | property | 881 |
| TArbiterMethod | procedural | 901 |
| TBitmask | alias | 71 |
| TBody | record | 376 |
| Ref | field | 378 |
| ApplyForceAtBody | procedure | 458 |
| ApplyForceAtWorld | procedure | 456 |
| ApplyImpulseAtBody | procedure | 462 |
| ApplyImpulseAtWorld | procedure | 460 |
| BodyToWorld | function | 452 |
| Equal | operator | 381 |
| Free | procedure | 419 |
| Implicit | operator | 379, 380 |
| IsNil | function | 421 |
| IsSleeping | function | 447 |
| NewBox | function | 432, 433, 434 |
| NewCircle | function | 426, 428 |
| NewPolygon | function | 436 |
| NewPolygonRaw | function | 439 |
| NewSegment | function | 430 |
| NotEqual | operator | 382 |
| Sleep | procedure | 443 |
| SleepWithGroup | procedure | 445 |
| UpdatePosition | procedure | 472 |
| UpdateVelocity | procedure | 469 |
| VelocityAtBody | function | 466 |
| VelocityAtWorld | function | 464 |
| WakeUp | procedure | 450 |
| WorldToBody | function | 454 |
| Angle | property | 491 |
| AngularVelocity | property | 493 |
| CenterOfGravity | property | 482 |
| Force | property | 489 |
| Kind | property | 475 |
| KineticEnergy | property | 500 |
| Mass | property | 478 |
| Moment | property | 480 |
| Position | property | 484 |
| PositionFunc | property | 504 |
| Rotation | property | 498 |
| Shape | property | 506 |
| Shapes | property | 510 |
| Torque | property | 496 |
| UserData | property | 508 |
| Velocity | property | 486 |
| VelocityFunc | property | 502 |
| TBodyHelper | helper | 1409 |
| EachArbiter | procedure | 1418, 1419 |
| Space | function | 1414 |
| Joints | property | 1421 |
| TBodyJointEnumerator | record | 810 |
| Create | function | 816 |
| GetEnumerator | function | 819 |
| MoveNext | function | 817 |
| Current | property | 818 |
| TBodyKind | alias | 131 |
| TBodyShapeEnumerator | record | 361 |
| Create | function | 367 |
| GetEnumerator | function | 370 |
| MoveNext | function | 368 |
| Current | property | 369 |
| TCircle | record | 147 |
| Ref | field | 149 |
| Free | procedure | 161 |
| Implicit | operator | 150, 151, 152, 153 |
| IsNil | function | 163 |
| Reshape | procedure | 165 |
| Offset | property | 169 |
| Radius | property | 167 |
| TCircleHelper | helper | 1287 |
| Base | function | 1290 |
| TCollisionEvent | procedural | 1153 |
| TCollisionEvents | record | 1156 |
| OnBegin | field | 1159 |
| OnPostSolve | field | 1164 |
| OnPreSolve | field | 1162 |
| OnSeparate | field | 1166 |
| TCollisionFilterEvent | procedural | 1151 |
| TCollisionHandler | alias | 76 |
| TCollisionType | alias | 73 |
| TDampedRotarySpringJoint | record | 637 |
| Ref | field | 639 |
| Implicit | operator | 640, 641 |
| Damping | property | 657 |
| RestAngle | property | 653 |
| Stiffness | property | 655 |
| TorqueFunc | property | 659 |
| TDampedRotarySpringJointHelper | helper | 1361 |
| Base | function | 1364 |
| TDampedSpringJoint | record | 603 |
| Ref | field | 605 |
| Implicit | operator | 606, 607 |
| Damping | property | 630 |
| ForceFunc | property | 632 |
| PinA | property | 623 |
| PinB | property | 624 |
| RestLength | property | 626 |
| Stiffness | property | 628 |
| TDampedSpringJointHelper | helper | 1353 |
| Base | function | 1356 |
| TGearJoint | record | 705 |
| Ref | field | 707 |
| Implicit | operator | 708, 709 |
| Phase | property | 717 |
| Ratio | property | 719 |
| TGearJointHelper | helper | 1385 |
| Base | function | 1388 |
| TGrooveJoint | record | 581 |
| Ref | field | 583 |
| Implicit | operator | 584, 585 |
| GrooveA | property | 595 |
| GrooveB | property | 596 |
| PinB | property | 598 |
| TGrooveJointHelper | helper | 1345 |
| Base | function | 1348 |
| TJoint | record | 739 |
| Ref | field | 741 |
| AsDampedRotarySpring | function | 779 |
| AsDampedSpring | function | 778 |
| AsGear | function | 782 |
| AsGroove | function | 777 |
| AsMotor | function | 783 |
| AsPin | function | 774 |
| AsPivot | function | 776 |
| AsRatchet | function | 781 |
| AsRotaryLimit | function | 780 |
| AsSlide | function | 775 |
| Equal | operator | 744 |
| Free | procedure | 768 |
| Implicit | operator | 742, 743 |
| IsGrab | function | 772 |
| IsNil | function | 770 |
| NotEqual | operator | 745 |
| A | property | 787 |
| B | property | 789 |
| CollideBodies | property | 791 |
| ErrorBias | property | 793 |
| Impulse | property | 799 |
| Kind | property | 785 |
| MaxBias | property | 795 |
| MaxForce | property | 797 |
| PostSolve | property | 803 |
| PreSolve | property | 801 |
| UserData | property | 805 |
| TJointHelper | helper | 1401 |
| Space | function | 1404 |
| TJointKind | enum | 141 |
| jointPin | enum value | 141 |
| jointSlide | enum value | 141 |
| jointPivot | enum value | 141 |
| jointGroove | enum value | 141 |
| jointDampedSpring | enum value | 141 |
| jointDampedRotarySpring | enum value | 142 |
| jointRotaryLimit | enum value | 142 |
| jointRatchet | enum value | 142 |
| jointGear | enum value | 142 |
| jointMotor | enum value | 142 |
| jointCustom | enum value | 143 |
| TMarchSample | procedural | 1237 |
| TMotorJoint | record | 724 |
| Ref | field | 726 |
| Implicit | operator | 727, 728 |
| Rate | property | 734 |
| TMotorJointHelper | helper | 1393 |
| Base | function | 1396 |
| TPinJoint | record | 515 |
| Ref | field | 517 |
| Implicit | operator | 518, 519 |
| Distance | property | 532 |
| PinA | property | 529 |
| PinB | property | 530 |
| TPinJointHelper | helper | 1321 |
| Base | function | 1324 |
| TPivotJoint | record | 562 |
| Ref | field | 564 |
| Implicit | operator | 565, 566 |
| PinA | property | 574 |
| PinB | property | 575 |
| TPivotJointHelper | helper | 1337 |
| Base | function | 1340 |
| TPolygon | record | 209 |
| Ref | field | 211 |
| Free | procedure | 223 |
| Implicit | operator | 212, 213, 214, 215 |
| IsNil | function | 225 |
| Reshape | procedure | 227, 229 |
| ReshapeRaw | procedure | 232 |
| Border | property | 234 |
| Vert | property | 238 |
| VertCount | property | 236 |
| TPolygonHelper | helper | 1303 |
| Base | function | 1306 |
| TPolyline | record | 1179 |
| Ref | field | 1181 |
| Copy | function | 1198 |
| Create | function | 1192 |
| Free | procedure | 1194 |
| Implicit | operator | 1182, 1183 |
| IsNil | function | 1196 |
| SimplifyCurves | function | 1202 |
| SimplifyVertexes | function | 1206 |
| ToArray | function | 1210 |
| ToConvexHull | function | 1208 |
| Closed | property | 1218 |
| Count | property | 1212 |
| Vert | property | 1214 |
| Verts | property | 1216 |
| TPolylineSet | record | 1241 |
| Ref | field | 1243 |
| AddSegment | procedure | 1276 |
| ConvexDecomposition | function | 1254 |
| Create | function | 1251 |
| Free | procedure | 1271 |
| GetEnumerator | function | 1278 |
| Implicit | operator | 1244, 1245 |
| IsNil | function | 1273 |
| MarchHard | function | 1265, 1268 |
| MarchSoft | function | 1258, 1261 |
| Count | property | 1280 |
| Line | property | 1282 |
| TPolylineSetEnumerator | record | 1223 |
| Create | function | 1229 |
| MoveNext | function | 1230 |
| Current | property | 1231 |
| TRatchetJoint | record | 682 |
| Ref | field | 684 |
| Implicit | operator | 685, 686 |
| Angle | property | 696 |
| Phase | property | 698 |
| Ratchet | property | 700 |
| TRatchetJointHelper | helper | 1377 |
| Base | function | 1380 |
| TRotaryLimitJoint | record | 664 |
| Ref | field | 666 |
| Implicit | operator | 667, 668 |
| Max | property | 677 |
| Min | property | 676 |
| TRotaryLimitJointHelper | helper | 1369 |
| Base | function | 1372 |
| TSegment | record | 174 |
| Ref | field | 176 |
| Free | procedure | 191 |
| Implicit | operator | 177, 178, 179, 180 |
| IsNil | function | 193 |
| Join | procedure | 196 |
| A | property | 200 |
| B | property | 202 |
| Border | property | 198 |
| Normal | property | 204 |
| TSegmentHelper | helper | 1295 |
| Base | function | 1298 |
| TShape | record | 243 |
| Ref | field | 245 |
| AsCircle | function | 288 |
| AsPolygon | function | 289 |
| AsSegment | function | 290 |
| CacheBB | function | 299 |
| Collide | function | 297 |
| Equal | operator | 248 |
| Free | procedure | 284 |
| Implicit | operator | 246, 247 |
| IsNil | function | 286 |
| NotEqual | operator | 249 |
| PointQuery | function | 293 |
| SegmentQuery | function | 295 |
| Update | function | 301 |
| Area | property | 315 |
| BoundingBox | property | 319 |
| Category | property | 351 |
| CenterOfGravity | property | 317 |
| CollisionType | property | 356 |
| Density | property | 311 |
| Elasticity | property | 327 |
| Filter | property | 346 |
| Friction | property | 330 |
| Group | property | 348 |
| Kind | property | 305 |
| Mask | property | 354 |
| Mass | property | 309 |
| Moment | property | 313 |
| Next | property | 303 |
| Sensor | property | 323 |
| SurfaceVelocity | property | 333 |
| UserData | property | 335 |
| TShapeHelper | helper | 1311 |
| Body | function | 1314 |
| Space | function | 1316 |
| TShapeKind | alias | 122 |
| TSlideJoint | record | 537 |
| Ref | field | 539 |
| Implicit | operator | 540, 541 |
| Max | property | 557 |
| Min | property | 556 |
| PinA | property | 553 |
| PinB | property | 554 |
| TSlideJointHelper | helper | 1329 |
| Base | function | 1332 |
| TSpace | record | 953 |
| Ref | field | 955 |
| Add | function | 1059, 1060, 1061 |
| AddCollisionHandler | function | 1006 |
| AddDefaultCollisionHandler | function | 1010 |
| AddPostStepCallback | function | 1014 |
| AddWildcardHandler | function | 1008 |
| BoxQuery | function | 1088 |
| Contains | function | 1068, 1069, 1070 |
| DebugDraw | procedure | 1104 |
| Free | procedure | 986 |
| Implicit | operator | 956, 957 |
| IsNil | function | 988 |
| NewBody | function | 1026 |
| NewDampedRotarySpring | function | 1048 |
| NewDampedSpring | function | 1046 |
| NewGear | function | 1052 |
| NewGroove | function | 1045 |
| NewKinematicBody | function | 1029 |
| NewMotor | function | 1054 |
| NewPin | function | 1041 |
| NewPivot | function | 1043, 1044 |
| NewRatchet | function | 1051 |
| NewRotaryLimit | function | 1050 |
| NewSlide | function | 1042 |
| NewStaticBody | function | 1032 |
| PointQuery | function | 1076 |
| PointQueryNearest | function | 1079 |
| ReindexBody | procedure | 1097 |
| ReindexShape | procedure | 1096 |
| ReindexStatic | procedure | 1095 |
| ReleaseBodies | procedure | 990 |
| ReleaseJoints | procedure | 992 |
| ReleaseObjects | procedure | 996 |
| Remove | procedure | 1064, 1065, 1066 |
| SegmentQuery | function | 1082 |
| SegmentQueryFirst | function | 1085 |
| ShapeQuery | function | 1090 |
| Step | procedure | 998 |
| UseSpatialHash | procedure | 1100 |
| Bodies | property | 1136 |
| CollisionBias | property | 1124 |
| CollisionPersistence | property | 1126 |
| CollisionSlop | property | 1122 |
| CurrentTimeStep | property | 1128 |
| Damping | property | 1112 |
| Gravity | property | 1114 |
| Ground | property | 1107 |
| IdleSpeedThreshold | property | 1117 |
| Iterations | property | 1109 |
| Joints | property | 1141 |
| Locked | property | 1130 |
| Shapes | property | 1138 |
| SleepTimeThreshold | property | 1120 |
| UserData | property | 1132 |
| TSpaceBodyEnumerator | record | 905 |
| Create | function | 912 |
| GetEnumerator | function | 915 |
| MoveNext | function | 913 |
| Current | property | 914 |
| TSpaceHelper | helper | 1426 |
| AddCollisionEvents | function | 1429 |
| AddDefaultCollisionEvents | function | 1435 |
| AddWildcardEvents | function | 1432 |
| TSpaceJointEnumerator | record | 935 |
| Create | function | 945 |
| GetEnumerator | function | 948 |
| MoveNext | function | 946 |
| Current | property | 947 |
| TSpaceShapeEnumerator | record | 920 |
| Create | function | 927 |
| GetEnumerator | function | 930 |
| MoveNext | function | 928 |
| Current | property | 929 |
| VectZero | constant | 79 |