Havok engine documentation?

Good day everyone!
I am just getting started with Babylon, and since I have read Havok has been adopted as new physics engine, I decided I would better take that way instead of previous engines (Ammo, Olmo, Cannon). So firstly, I would ask you: do you think it is a good call?
Secondly, I have not found much documentation about the workflow with Havok, and I am struggling trying to understand about meshes, physic aggregates, transform nodes. Do you know any good and complete source of this documentation?

Thank you so much in advance!

Hi!

The new physics architexture is much better than the old one, so I would recommend you to use it (and not Ammo/Cannon/Oimo, at least not until they are ported to the new architecture).

About Havok documentation - Babylon abstracts working with the physics engine for you, so the doc you are looking for is the physics architecture’s pages and not exactly havok. Have you seen these pages? Physics | Babylon.js Documentation (babylonjs.com)

1 Like

Hello Raanan, thank you for your response and clarification. I will dive deep into that doc.
Once again, thank you and have a good week!

1 Like

Interesting. Is this a premium information about your plans? What exactly would be the benefits of using the old version physics ported to the new architecture? Is it just to keep with ‘a range’ of solutions? I must say you got me wondering with this information. :thinking:

not at all :slight_smile:
Havok is so amazing, there is no reason to use any other engine. However, if some community member decides to build a cannon.js plugin we wouldn’t reject the PR

1 Like

I need physics getting started documentation!

I can make simple cases, but I can’t handle them if the parameters are more complex.
There is no detailed description of each parameter, so it is difficult to improve work efficiency by guessing.
PG:

let joint = new BABYLON.HingeConstraint(
new BABYLON.Vector3(0, 0, -0.5),
new BABYLON.Vector3(0, 0, 1.5),
undefined,
undefined,
scene
);
What do the HingeConstraint parameters mean?

PG:

I want to create such an effect, but I can’t restore it in PG. I can comment out lines 76-98 of the code first, and look at the initial state first, and then add the physics engine, but the effect is wrong. How can I change it so that it looks like the video effect?

CC @Cedric and @carolhmj

I think you are getting pretty close from what you expect.
I’ve changed your PG so everything is at rest when starting : https://playground.babylonjs.com/#7DMWP8#605

I believe it’s then easier to iterate. you can add a controllable impulse.
Then, there is no collision detection with the sphere. You can change the default box shape with a compound:

1 Like

Cedric beat me to it, but I also tweaked your playground a bit :slight_smile: I added the sphere shape through a compound, and also modified the meshes creations a bit to not set any scales, as decomposing a transformation that has scales can lead to more error: physics hing Constraint | Babylon.js Playground (babylonjs.com)

About the two penultimate parameters in the Hinge Constraint, that’s a good catch, I’ll amend the docs! They are the two axes of the constraint, which determines the orientation of each body. You can read more about how constraint works here: Constraints | Babylon.js Documentation (babylonjs.com)

2 Likes

Thank you all!

The most important is:
I need physics getting started documentation!

There is a getting started documentation: Using A Physics Engine | Babylon.js Documentation (babylonjs.com) but if you believe anything is missing from there please let us know :slight_smile:

let joint = new BABYLON.HingeConstraint(
new BABYLON.Vector3(0, 0, -0.5),
new BABYLON.Vector3(0, 0, 1.5),
undefined,
undefined,
scene
);

What do the HingeConstraint parameters mean?

I need more params mean!
It feels so bad to guess!

let joint = new BABYLON.BallAndSocketConstraint(
        new BABYLON.Vector3(-0.5, 0, -0.5),
        new BABYLON.Vector3(-0.5, 0, 0.5),
        new BABYLON.Vector3(0, 1, 0),
        new BABYLON.Vector3(0, 1, 0),
        scene
    );

let joint = new BABYLON.PrismaticConstraint(
        new BABYLON.Vector3(0, 0, -0.2),
        new BABYLON.Vector3(0, 0, 0.25),
        new BABYLON.Vector3(0, 1, 0),
        new BABYLON.Vector3(0, 1, 0),
        scene
    );

let joint = new BABYLON.LockConstraint(
        new BABYLON.Vector3(0.5, 0.5, -0.5),
        new BABYLON.Vector3(-0.5, -0.5, 0.5),
        new BABYLON.Vector3(0, 1, 0),
        new BABYLON.Vector3(0, 1, 0),
        scene
    );

let joint = new BABYLON.SliderConstraint(
        new BABYLON.Vector3(0, 0, -0.2),
        new BABYLON.Vector3(0, 0, 0.25),
        new BABYLON.Vector3(0, 1, 0),
        new BABYLON.Vector3(0, 1, 0),
        scene
    );

let joint = new BABYLON.Physics6DoFConstraint(
        {
            pivotA: new BABYLON.Vector3(0, -0.5, 0),
            pivotB: new BABYLON.Vector3(0, 0.5, 0),
            perpAxisA: new BABYLON.Vector3(1, 0, 0),
            perpAxisB: new BABYLON.Vector3(1, 0, 0),
        },
        [
            {
                axis: BABYLON.PhysicsConstraintAxis.LINEAR_DISTANCE,
                minLimit: 1,
                maxLimit: 2,
            },
        ],
        scene
    );

Constraints all work the same. It’s the degrees of liberty that change.
The constraint is always around or 2 axis. And an axis is always composed of a direction vector and a local point that acts as an origin for that axis.

Then, per constraint, the documentation exists to specify how many axis : Constraints | Babylon.js Documentation

For example, Hinge states: only allowing relative rotation around one axis.

It might be hard to visualize in your mind how the constraint will work but it’s in our roadmap to improve that part.

Looking forward to the documentation earlier, promoting the promotion of physical engine!