@@ -1596,6 +1596,8 @@ declare class Body$1 {
1596
1596
/**
1597
1597
* Set the type of the body to "static", "kinematic" or "dynamic".
1598
1598
* @param type The type of the body.
1599
+ *
1600
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
1599
1601
*/
1600
1602
setType ( type : BodyType ) : void ;
1601
1603
isBullet ( ) : boolean ;
@@ -1625,6 +1627,8 @@ declare class Body$1 {
1625
1627
* in collisions, ray-casts, or queries. Joints connected to an inactive body
1626
1628
* are implicitly inactive. An inactive body is still owned by a World object
1627
1629
* and remains
1630
+ *
1631
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
1628
1632
*/
1629
1633
setActive ( flag : boolean ) : void ;
1630
1634
isFixedRotation ( ) : boolean ;
@@ -1641,6 +1645,8 @@ declare class Body$1 {
1641
1645
* transform may cause non-physical behavior. Note: contacts are updated on the
1642
1646
* next call to World.step.
1643
1647
*
1648
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
1649
+ *
1644
1650
* @param position The world position of the body's local origin.
1645
1651
* @param angle The world rotation in radians.
1646
1652
*/
@@ -1649,6 +1655,8 @@ declare class Body$1 {
1649
1655
* Set the position of the body's origin and rotation. Manipulating a body's
1650
1656
* transform may cause non-physical behavior. Note: contacts are updated on the
1651
1657
* next call to World.step.
1658
+ *
1659
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
1652
1660
*/
1653
1661
setTransform ( xf : Transform ) : void ;
1654
1662
synchronizeTransform ( ) : void ;
@@ -1751,6 +1759,8 @@ declare class Body$1 {
1751
1759
* destroying fixtures can also alter the mass. This function has no effect if
1752
1760
* the body isn't dynamic.
1753
1761
*
1762
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
1763
+ *
1754
1764
* @param massData The mass properties.
1755
1765
*/
1756
1766
setMassData ( massData : MassData ) : void ;
@@ -1812,7 +1822,7 @@ declare class Body$1 {
1812
1822
*
1813
1823
* Contacts are not created until the next time step.
1814
1824
*
1815
- * Warning: This function is locked during callbacks .
1825
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step .
1816
1826
*/
1817
1827
createFixture ( def : FixtureDef ) : Fixture ;
1818
1828
createFixture ( shape : Shape , opt ?: FixtureOpt ) : Fixture ;
@@ -1824,7 +1834,7 @@ declare class Body$1 {
1824
1834
* All fixtures attached to a body are implicitly destroyed when the body is
1825
1835
* destroyed.
1826
1836
*
1827
- * Warning: This function is locked during callbacks .
1837
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step .
1828
1838
*
1829
1839
* @param fixture The fixture to be removed.
1830
1840
*/
@@ -2074,13 +2084,15 @@ export declare class World {
2074
2084
* position -= newOrigin
2075
2085
*
2076
2086
* @param newOrigin The new origin with respect to the old origin
2087
+ *
2088
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
2077
2089
*/
2078
2090
shiftOrigin ( newOrigin : Vec2Value ) : void ;
2079
2091
/**
2080
2092
* Create a rigid body given a definition. No reference to the definition is
2081
2093
* retained.
2082
2094
*
2083
- * Warning: This function is locked during callbacks .
2095
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step .
2084
2096
*/
2085
2097
createBody ( def ?: BodyDef ) : Body$1 ;
2086
2098
createBody ( position : Vec2Value , angle ?: number ) : Body$1 ;
@@ -2089,24 +2101,26 @@ export declare class World {
2089
2101
createKinematicBody ( def ?: BodyDef ) : Body$1 ;
2090
2102
createKinematicBody ( position : Vec2Value , angle ?: number ) : Body$1 ;
2091
2103
/**
2092
- * Destroy a rigid body given a definition. No reference to the definition is
2093
- * retained.
2104
+ * Destroy a body from the world.
2094
2105
*
2095
2106
* Warning: This automatically deletes all associated shapes and joints.
2096
2107
*
2097
- * Warning: This function is locked during callbacks .
2108
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step .
2098
2109
*/
2099
2110
destroyBody ( b : Body$1 ) : boolean ;
2100
2111
/**
2101
2112
* Create a joint to constrain bodies together. No reference to the definition
2102
2113
* is retained. This may cause the connected bodies to cease colliding.
2103
2114
*
2104
- * Warning: This function is locked during callbacks .
2115
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step .
2105
2116
*/
2106
2117
createJoint < T extends Joint > ( joint : T ) : T | null ;
2107
2118
/**
2108
- * Destroy a joint. This may cause the connected bodies to begin colliding.
2109
- * Warning: This function is locked during callbacks.
2119
+ * Destroy a joint.
2120
+ *
2121
+ * Warning: This may cause the connected bodies to begin colliding.
2122
+ *
2123
+ * Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
2110
2124
*/
2111
2125
destroyJoint ( joint : Joint ) : void ;
2112
2126
/**
@@ -2118,6 +2132,10 @@ export declare class World {
2118
2132
* @param timeStep Time step, this should not vary.
2119
2133
*/
2120
2134
step ( timeStep : number , velocityIterations ?: number , positionIterations ?: number ) : void ;
2135
+ /**
2136
+ * Queue a function to be called after ongoing simulation step. If no simulation is in progress call it immediately.
2137
+ */
2138
+ queueUpdate ( callback : ( world : World ) => unknown ) : void ;
2121
2139
/**
2122
2140
* Called when two fixtures begin to touch.
2123
2141
*
0 commit comments