Skip to content

SimObj is_dynamic vibrates excessively. #111

@JamesNewton

Description

@JamesNewton

Make a stack of objects all set to be dynamic, and watch them vibrate against each other and eventually fall over.

It turns out that through a happy accident I found a solution to this: Turning on dynamic mode by turning off kinematic mode without changing anything else. e.g.

var my_obj = SimObj.make_object3d({name: "my_object3d", parent: "scene", geometry: "Box",
    scale: [0.2, 0.2, 0.2], position: [0.0, 0.3, 0.1], orientation: [0.0, 0.0, 0.0],
    material: "MeshNormal", color: [1, 1, 1],
    wireframe: false, is_dynamic: false, mass: 1
})
my_obj.userData.physObj.kinematic = false

This gives you an object that is dynamic, but doesn't vibrate excessively.

After looking about a bit in the code, it appears that this routine
https://github.com/cfry/dde/blob/dde4/src/simulator/physicsObject.js#L757
is setting the mass of the object to ZERO! Which, I'm pretty sure, is what makes it shake. Given some mass, they settle down. I'm not sure about the other flags:

  • .setActivationState
  • .setCollisionFlags

As those don't seem to be required, but maybe they make the difference?

More experimentation is needed. E.g. replacing the code for

  • PhysicsObject.makeKinematic() and
  • ‎PhysicsObject.makeDynamic()
    with version which don't change the mass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions