mirror of
https://github.com/4ian/GDevelop.git
synced 2026-10-12 02:01:17 +00:00
* The 3D physics engine is powered by [Jolt Physics](https://github.com/jrouwe/JoltPhysics) a modern, performant, battle-tested, fully featured 3D physics engine used in AAA games, like Horizon: Forbidden West. The new 3D physics engine is perfect for making FPS, TPS, 3D platformer and in the future 3D racing games or any 3D game. * Similar to the 2D physics engine, you can add the 3D Physics behavior to your object. For example, add the behavior to platforms with the type set to "Static". * You can choose the collider shape: box, sphere, cylinder or capsule and modify physics properties of the objects having this behavior - much like the 2D physics engine. * For characters, a dedicated "3D Physics Character" behavior is available. Pair it with one or more additional behaviors to get controls working out of the box: "3D Shooter keyboard mapper", "3D Platformer keyboard mapper", etc... * Take a look at the new examples to give it a try! New examples and behaviors will be progressively added.
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
namespace gdjs {
|
|
export namespace physics2 {
|
|
export const areObjectsColliding = function (
|
|
objectsLists1: Hashtable<Array<gdjs.RuntimeObject>>,
|
|
behaviorName: string,
|
|
objectsLists2: Hashtable<Array<gdjs.RuntimeObject>>,
|
|
inverted: boolean
|
|
) {
|
|
return gdjs.evtTools.object.twoListsTest(
|
|
gdjs.Physics2RuntimeBehavior.areObjectsColliding,
|
|
objectsLists1,
|
|
objectsLists2,
|
|
inverted,
|
|
behaviorName
|
|
);
|
|
};
|
|
|
|
export const haveObjectsStartedColliding = function (
|
|
objectsLists1: Hashtable<Array<gdjs.RuntimeObject>>,
|
|
behaviorName: string,
|
|
objectsLists2: Hashtable<Array<gdjs.RuntimeObject>>,
|
|
inverted: boolean
|
|
) {
|
|
return gdjs.evtTools.object.twoListsTest(
|
|
gdjs.Physics2RuntimeBehavior.hasCollisionStartedBetween,
|
|
objectsLists1,
|
|
objectsLists2,
|
|
inverted,
|
|
behaviorName
|
|
);
|
|
};
|
|
|
|
export const haveObjectsStoppedColliding = function (
|
|
objectsLists1: Hashtable<Array<gdjs.RuntimeObject>>,
|
|
behaviorName: string,
|
|
objectsLists2: Hashtable<Array<gdjs.RuntimeObject>>,
|
|
inverted: boolean
|
|
) {
|
|
return gdjs.evtTools.object.twoListsTest(
|
|
gdjs.Physics2RuntimeBehavior.hasCollisionStoppedBetween,
|
|
objectsLists1,
|
|
objectsLists2,
|
|
inverted,
|
|
behaviorName
|
|
);
|
|
};
|
|
|
|
export const setTimeScale = function (objectsLists, behavior, timeScale) {
|
|
const lists = gdjs.staticArray(gdjs.physics2.setTimeScale);
|
|
objectsLists.values(lists);
|
|
for (let i = 0, len = lists.length; i < len; i++) {
|
|
const list = lists[i];
|
|
for (let j = 0, lenj = list.length; j < lenj; j++) {
|
|
gdjs.Physics2RuntimeBehavior.setTimeScaleFromObject(
|
|
list[j],
|
|
behavior,
|
|
timeScale
|
|
);
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|