How can I use new Ammo() in My Project?

var MyVehicle = pc.createScript('myVehicle');
I want to use Ammo look like this.but it show me Ammo is not defined!
I need to include ammo.js by myself?

var ammoVec = new Ammo.btVector3();
// 获取一个Ammo的四元数数据类型
var ammoQuat = new Ammo.btQuaternion();
// 获取一个Ammo的transform数据类型,相当于是个矩阵,可以表示pos和rot
var ammoTransform = new Ammo.btTransform();

var wheelDirection = new Ammo.btVector3(0, -1, 0);
var wheelAxle = new Ammo.btVector3(-1, 0, 0);

MyVehicle.prototype.localCreateRigidBody=function(mass, transform, shape) {
    var localInertia = new Ammo.btVector3(0, 0, 0);
    if (mass > 0) {
        shape.calculateLocalInertia(mass, localInertia);

    var motionState = new Ammo.btDefaultMotionState(transform);
    var bodyInfo = new Ammo.btRigidBodyConstructionInfo(mass, motionState, shape, localInertia);
    var body = new Ammo.btRigidBody(bodyInfo);
    return body;

Hi there,

You need to enable physics.

Click the Settings icon ( bottom icon in the left hand panel ), then in the right panel under Physics, tick the Enable button. Ammo.js will now be included.

1 Like

thank you very much!!!:grin: