Babylon.js icon indicating copy to clipboard operation
Babylon.js copied to clipboard

PhysicsAggregate does not update mesh with setAngularVelocity and setLinearVelocity after 7.2.1 update

Open miradontsoa opened this issue 2 years ago • 5 comments

Hello, After updating from 7.2.0 to 7.2.1, in the following code, the cube does not rotate and does not move anymore:


// Moving cube
  const movingCube = BABYLON.MeshBuilder.CreateBox(
    'moving_cube',
    { height: 1, width: 1, depth: 1 },
    scene
  )

  const movingCubePhysicsAggregate = new BABYLON.PhysicsAggregate(
    movingCube,
    BABYLON.PhysicsShapeType.BOX,
    {
      mass: 1,
      restitution: 0.1,
      friction: 0.4,
      startAsleep: false
    },
    scene
  )
  movingCubePhysicsAggregate.body.setMotionType(BABYLON.PhysicsMotionType.ANIMATED) // PhysicsMotionType is ANIMATED
  movingCubePhysicsAggregate.body.setAngularVelocity(new BABYLON.Vector3(0, 1, 0))
  movingCubePhysicsAggregate.body.setLinearVelocity(new BABYLON.Vector3(0, 1, 0))

I do not know if this is related ot the following pull request: https://github.com/BabylonJS/Babylon.js/pull/14972

miradontsoa avatar Apr 16 '24 10:04 miradontsoa

Thanks for reporting! We use github issues to track existing issues in code, and prefer discussions on the forum (like the bug template has suggested). cc @CedricGuillemet. Would be great if you could ping us on the forum with the code.

@CedricGuillemet - please reopen if needed.

RaananW avatar Apr 16 '24 14:04 RaananW

https://github.com/BabylonJS/Babylon.js/pull/14990

CedricGuillemet avatar Apr 16 '24 14:04 CedricGuillemet

as a work around, until next release, you can toggle the disableSync flag

https://playground.babylonjs.com/#3KHPED

CedricGuillemet avatar Apr 16 '24 14:04 CedricGuillemet

Thanks for reporting! We use github issues to track existing issues in code, and prefer discussions on the forum (like the bug template has suggested). cc @CedricGuillemet. Would be great if you could ping us on the forum with the code.

@CedricGuillemet - please reopen if needed.

OK, I will do so for next one

miradontsoa avatar Apr 18 '24 12:04 miradontsoa

Fixed in 7.3

miradontsoa avatar Apr 18 '24 12:04 miradontsoa