MCPcopy
hub / github.com/piqnt/planck.js / moveAABB

Function moveAABB

example/DynamicTreeTest.ts:207–230  ·  view source on GitHub ↗
(aabb: AABB)

Source from the content-addressed store, hash-verified

205}
206
207function moveAABB(aabb: AABB) {
208 const d = {
209 x: Math.random(-0.5, 0.5),
210 y: Math.random(-0.5, 0.5),
211 };
212 // d.x = 2.0;
213 // d.y = 0.0;
214 aabb.lowerBound.add(d);
215 aabb.upperBound.add(d);
216
217 const c0 = Vec2.mid(aabb.lowerBound, aabb.upperBound);
218 const min = {
219 x: -WORLD_EXTENT,
220 y: 0.0,
221 };
222 const max = {
223 x: WORLD_EXTENT,
224 y: 2.0 * WORLD_EXTENT,
225 };
226 const c = Vec2.clampVec2(c0, min, max);
227
228 aabb.lowerBound.add(c).sub(c0);
229 aabb.upperBound.add(c).sub(c0);
230}
231
232function createProxy() {
233 for (let i = 0; i < actors.length; ++i) {

Callers 1

moveProxyFunction · 0.85

Calls 5

randomMethod · 0.80
midMethod · 0.80
clampVec2Method · 0.80
addMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected