Havok Physic issue unable to move the cans using the platform

Hi
I have an issue with Havok Physics; it’s unable to move the cans using the barrel platform is there any solution ?

Please share a PG. its difficult to telle you what’s wrong without.
Did you try to increase friction?

1 Like

Did you try to increase friction?

Yes, but it has no effect

1 Like

@eoin , is there a way to make the cylinder follow without adding force in collision event?

1 Like

Yes, the reason it appears there’s no friction is that when changing the position like that, it’s essentially teleporting the body, so the body sort of “appears” in the new location, instead of traveling through the intermediate space.

Instead of teleporting the body, you can use PhysicsBody.setTargetTransform(), which will calculate velocities so a body reaches the target in the next step; I’ve just changed line 85 in that playground:

4 Likes

@Cedric I was using setPhysicsBodyTransformation to teleport a body, after 7.13 throws “Invalid prestep type set to physics body.”

@mpaleo.meetkai can you share a PG?

1 Like

hey! @Cedric
here I modified the SetTargetTransform playground to use setPhysicsBodyTransformation instead

I was using setPhysicsBodyTransformation to teleport a car body when missing a race checkpoint

Yes, physics prestep is disabled by default, you’ll have to enable it.

https://doc.babylonjs.com/features/featuresDeepDive/physics/prestep

EDIT: The warning is not very explicit. I’ll fix it.

1 Like
1 Like

Hey sorry @Cedric, but could u modify this playground to explain how it works ?
I tried with disablePreStep and setPrestepType but I get errors in the console

Sure! Here it is https://playground.babylonjs.com/#FLCVX1#13

1 Like

@Cedric sorry I’m still not able to get it done, so basically my scenario is, I have a car going at certain speed, and I need to respawn/teleport to another position, before I was just using havokPlugin.setPhysicsBodyTransformation(body, respawnPosition), I tried with setTargetTransform but the car gets thrown into the skies. But basically how can I do the teleport ? sorry

Setting disablePrestep and modification of the position should be enough then.

1 Like