Why is ammoJSPlugin not able to get contact points with ConcreteContactResultCallback?

Hi.
I’m using ammoJSPlugin.
I can get contact events between objects, but I can’t get contact points.

It seems that the contact point can be obtained via _tmpAmmoConcreteContactResultCallback.addSingleResult by calling contactPairTest in _isImpostorPairInContact, but the current implementation is as follows, and it is not an implementation that can take the contact point.

See ammoJSPlugin.ts.

        this._tmpAmmoConcreteContactResultCallback = new this.bjsAMMO.ConcreteContactResultCallback();
        this._tmpAmmoConcreteContactResultCallback.addSingleResult = () => { this._tmpContactCallbackResult = true; };

Why isn’t babylon.js trying to implement it to take contact points?

Invoking @Cedric

Let me check if I can add contact point to the CB parameters …

PR : contact point in registerOnPhysicsCollide callback by CedricGuillemet · Pull Request #9086 · BabylonJS/Babylon.js · GitHub

1 Like

Only necro-threading this topic because I encountered a potential issue that might have directly been introduced by this PR (see highlighted line) - contact point in registerOnPhysicsCollide callback by CedricGuillemet · Pull Request #9086 · BabylonJS/Babylon.js (github.com)

I’m having an issue using Ammo with ES6+WebPack. I’ve gotten everything working normally and great and such, but when I get a physics collision fired, an exception is thrown.

For ease of reference, the error is “Ammo is not defined”, and the line/statement that throws this is in the ammoJSPlugin.ts, ln 94:
contactPoint = this.bjsAMMO.wrapPointer(contactPoint, Ammo.btManifoldPoint);

Abridged Exception Text:

ammoJSPlugin.ts:94 Uncaught ReferenceError: Ammo is not defined
    at OB.AmmoJSPlugin._tmpAmmoConcreteContactResultCallback.addSingleResult (ammoJSPlugin.ts:94)

Not sure why, I’ve verified that the ammo promise has been resolved before calling any physics methods, and I’m injecting the ammo reference in the plugin ctor as usual:
let plugin = new AmmoJSPlugin(true, ammoModule);. As well, there doesn’t seem to be any other issues using the physics methods, like applyImpulse and such.

Is this something more likely I’m doing wrong, or is it a potential defect with the code?

ed: here are the relevant imports in the file where I’m seeing this issue, just in case it’s useful:

import { PhysicsHelper } from "@babylonjs/core/Physics/physicsHelper";
import { PhysicsImpostor } from "@babylonjs/core/Physics/physicsImpostor";
import { AmmoJSPlugin } from "@babylonjs/core/Physics/Plugins/ammoJSPlugin";
import "@babylonjs/core/Physics/physicsEngineComponent";
import { ammoModule, ammoReadyPromise } from "../externals/ammoWrapper";

Might be an issue with a callback or smthg where this would not be the correct one ???

A repro in the playground would be great ? or in Github ?

Of course! This doesn’t happen in the PG AFAICT, so here’s the deployed staging site, which is composed from this code repo.

To trigger the repro (in the repos, heh) select play from the main menu. In the next screen, press CTRL to launch the Cargo, DEL or Backspace to reset the simulation. The exception is thrown the moment of contact between the cargo and any of the planets or star.

Thanks for looking at this!

Are you using the latest version ??? (just a quick check)

I do not see any exception on my side :frowning:

Oh geez I think I commented out the collision code in that build, sorry! Give me a couple minutes to deploy a new build with the stuff uncommented

Ed: deployments done try now @sebavan

Ok Found it, I ll push a new update soon

1 Like

Nightly in progres should be up in 1 hour

1 Like

Thanks for fixing this @sebavan - I appreciate your efforts!

Any idea on when the next npm 5.0 alpha packages will be built?

I ll do one in one hour :wink:

1 Like