@gg-web-engine/ammo 0.0.30 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/build_gg_ammo/Makefile +41 -0
- package/build_gg_ammo/README.md +17 -0
- package/build_gg_ammo/ammo_patches.txt +20 -0
- package/build_gg_ammo/bullet_patches.txt +27 -0
- package/build_gg_ammo/patch_files/ammo.idl +2380 -0
- package/dist/ammo-debugger.d.ts +1 -1
- package/dist/ammo-debugger.js +1 -1
- package/dist/ammo-factory.d.ts +1 -1
- package/dist/ammo-factory.js +1 -1
- package/dist/ammo.js/ammo-ambient.d.ts +2577 -0
- package/dist/ammo.js/ammo.d.ts +2578 -0
- package/dist/ammo.js/ammo.js +43 -0
- package/dist/ammo.js/ammo.wasm.js +1315 -0
- package/dist/ammo.js/ammo.wasm.wasm +0 -0
- package/dist/components/ammo-body.component.d.ts +1 -1
- package/dist/components/ammo-body.component.js +5 -6
- package/dist/components/ammo-raycast-vehicle.component.d.ts +9 -2
- package/dist/components/ammo-raycast-vehicle.component.js +32 -4
- package/dist/components/ammo-rigid-body.component.d.ts +1 -1
- package/dist/components/ammo-rigid-body.component.js +3 -3
- package/dist/components/ammo-trigger.component.d.ts +1 -1
- package/dist/components/ammo-trigger.component.js +4 -4
- package/dist/components/ammo-world.component.d.ts +1 -1
- package/dist/components/ammo-world.component.js +4 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +32 -8
- package/test/components/ammo-trigger.component.spec.ts +122 -0
- package/tsconfig.json +2 -2
- package/dist/ammo-utils.d.ts +0 -2
- package/dist/ammo-utils.js +0 -1
package/README.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
## [Ammo.js](https://github.com/kripken/ammo.js) integration for [gg-web-engine](https://github.com/AndyGura/gg-web-engine), providing 3D phycics simulation
|
|
6
6
|
|
|
7
|
+
### Note:
|
|
8
|
+
This module uses self-built ammo.js, because requires additional functionality. Do not install another copy of ammo.js,
|
|
9
|
+
if you need direct access, import it straight from this module:
|
|
10
|
+
```typescript
|
|
11
|
+
import { Ammo } from "@gg-web-engine/ammo";
|
|
12
|
+
```
|
|
13
|
+
|
|
7
14
|
### Installation:
|
|
8
15
|
1) make sure **@gg-web-engine/core** installed
|
|
9
16
|
1) `npm install --save @gg-web-engine/ammo`
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Define variables
|
|
2
|
+
AMMOJS_GIT_REPO=https://github.com/i12345/ammo.js.git
|
|
3
|
+
AMMOJS_GIT_COMMIT=98d8fb3e8d5b3f3b581e7c5fe8856edb91b578d8
|
|
4
|
+
BULLET_GIT_REPO=https://github.com/bulletphysics/bullet3.git
|
|
5
|
+
BULLET_GIT_COMMIT=2c204c49e56ed15ec5fcfa71d199ab6d6570b3f5 # 3.25 release
|
|
6
|
+
REPLACE_SRC_DIR=./patch_files
|
|
7
|
+
REPLACE_DEST_DIR=./ammo.js
|
|
8
|
+
|
|
9
|
+
clean-all:
|
|
10
|
+
rm -rf ./ammo.js && rm -rf ./ammo_patches.txt && rm -rf ./bullet_patches.txt
|
|
11
|
+
|
|
12
|
+
fetch_ammo:
|
|
13
|
+
git clone $(AMMOJS_GIT_REPO)
|
|
14
|
+
|
|
15
|
+
switch_ammo:
|
|
16
|
+
cd ammo.js && git checkout $(AMMOJS_GIT_COMMIT)
|
|
17
|
+
|
|
18
|
+
fetch_bullet:
|
|
19
|
+
cd ammo.js && git clone $(BULLET_GIT_REPO) bullet
|
|
20
|
+
|
|
21
|
+
switch_bullet:
|
|
22
|
+
cd ammo.js/bullet && git checkout $(BULLET_GIT_COMMIT)
|
|
23
|
+
|
|
24
|
+
replace:
|
|
25
|
+
cp -r $(REPLACE_SRC_DIR)/* $(REPLACE_DEST_DIR)
|
|
26
|
+
cd ammo.js && git diff > ../ammo_patches.txt
|
|
27
|
+
cd ammo.js/bullet && git diff > ../../bullet_patches.txt
|
|
28
|
+
|
|
29
|
+
build:
|
|
30
|
+
cd ammo.js && npm i && npm run build:clean && docker-compose build && docker-compose up && npm run build:export
|
|
31
|
+
|
|
32
|
+
copy:
|
|
33
|
+
cp -r ./ammo.js/dist/* ../src/ammo.js
|
|
34
|
+
|
|
35
|
+
cleanup:
|
|
36
|
+
rm -rf ./ammo.js
|
|
37
|
+
|
|
38
|
+
fetch_all: clean-all fetch_ammo switch_ammo fetch_bullet switch_bullet
|
|
39
|
+
build_all: replace build copy
|
|
40
|
+
|
|
41
|
+
all: fetch_all build_all cleanup
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
This is a place where I build proprietary ammo.js for gg-web-engine.
|
|
2
|
+
|
|
3
|
+
Reasons to build own ammo.js instead of using [up-to-date one](https://github.com/i12345/ammo.js):
|
|
4
|
+
1) The crucial feature, which bullet does not have: use collision groups for raycast vehicle. I already made a
|
|
5
|
+
[PR](https://github.com/bulletphysics/bullet3/pull/4559) to bullet.
|
|
6
|
+
1) Manually added functions "getPointer" and "compare" to type declarations.
|
|
7
|
+
[PR](https://github.com/anotherpit/webidl2ts/pull/2) to webidl2ts is also on it's way
|
|
8
|
+
1) Expose `m_erp2` property of `btContactSolverInfo`, needed for fighting with object clipping problem,
|
|
9
|
+
which appeared in bullet 2.84. Also made a [PR](https://github.com/i12345/ammo.js/pull/2)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
All changed file diffs in ammo.js and bullet can be found [here](./ammo_patches.txt) and [here](./bullet_patches.txt) appropriately
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### How to build
|
|
16
|
+
1) Docker has to be installed and started
|
|
17
|
+
1) enter this directory and run `make all`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
diff --git a/ammo.idl b/ammo.idl
|
|
2
|
+
index 1f6b880..9c2e5cf 100644
|
|
3
|
+
--- a/ammo.idl
|
|
4
|
+
+++ b/ammo.idl
|
|
5
|
+
@@ -1293,6 +1293,8 @@ interface btVehicleRaycasterResult {
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
interface btVehicleRaycaster {
|
|
9
|
+
+ attribute long m_collisionFilterGroup;
|
|
10
|
+
+ attribute long m_collisionFilterMask;
|
|
11
|
+
void castRay ([Const, Ref] btVector3 from, [Const, Ref] btVector3 to, [Ref] btVehicleRaycasterResult result);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
diff --git a/bullet b/bullet
|
|
15
|
+
index 6bb8d11..2c204c4 160000
|
|
16
|
+
--- a/bullet
|
|
17
|
+
+++ b/bullet
|
|
18
|
+
@@ -1 +1 @@
|
|
19
|
+
-Subproject commit 6bb8d1123d8a55d407b19fd3357c724d0f5c9d3c
|
|
20
|
+
+Subproject commit 2c204c49e56ed15ec5fcfa71d199ab6d6570b3f5-dirty
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
diff --git a/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp b/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp
|
|
2
|
+
index cbb41ece2..44b0c3020 100644
|
|
3
|
+
--- a/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp
|
|
4
|
+
+++ b/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp
|
|
5
|
+
@@ -690,6 +690,9 @@ void* btDefaultVehicleRaycaster::castRay(const btVector3& from, const btVector3&
|
|
6
|
+
|
|
7
|
+
btCollisionWorld::ClosestRayResultCallback rayCallback(from, to);
|
|
8
|
+
|
|
9
|
+
+ rayCallback.m_collisionFilterMask = m_collisionFilterMask;
|
|
10
|
+
+ rayCallback.m_collisionFilterGroup = m_collisionFilterGroup;
|
|
11
|
+
+
|
|
12
|
+
m_dynamicsWorld->rayTest(from, to, rayCallback);
|
|
13
|
+
|
|
14
|
+
if (rayCallback.hasHit())
|
|
15
|
+
diff --git a/src/BulletDynamics/Vehicle/btVehicleRaycaster.h b/src/BulletDynamics/Vehicle/btVehicleRaycaster.h
|
|
16
|
+
index 2c44ce546..e74dc6c41 100644
|
|
17
|
+
--- a/src/BulletDynamics/Vehicle/btVehicleRaycaster.h
|
|
18
|
+
+++ b/src/BulletDynamics/Vehicle/btVehicleRaycaster.h
|
|
19
|
+
@@ -16,6 +16,8 @@
|
|
20
|
+
/// btVehicleRaycaster is provides interface for between vehicle simulation and raycasting
|
|
21
|
+
struct btVehicleRaycaster
|
|
22
|
+
{
|
|
23
|
+
+ int m_collisionFilterMask;
|
|
24
|
+
+ int m_collisionFilterGroup;
|
|
25
|
+
virtual ~btVehicleRaycaster()
|
|
26
|
+
{
|
|
27
|
+
}
|