When using cannon I was able to force a physics body to get a new position by setting the new position in cannon directly:
constr newPosition = new Cannon.Vec3(x, y, z)
myMesh.physicsImpostor.physicsBody.position = newPosition
Is something like this possible with the new havok engine? It’s ab it difficult to figure this stuff out, since there seems to be not documentation available of the underlying engine?
You can set body.disablePreStep to false, change the position of the transformNode linked to the body, then set body.disablePreStep to true after the next frame has executed
@Raggar Feels like the same thing with extra steps Appreciate the help though, it’s probably a viable alternative. For my case however, I need to execute this in a registerBeforePhysicsStep callback, so setting it directly probably makes a bit more sense. First I need to figure out how to actually implement/use a registerBeforePhysicsStep callback though, since apparently it’s not present in the v2 system
What @carolhmj said. For performance reason (because 99.99% of time, it’s not needed), the prestep that sets the physics body transform from the mesh transform is disabled. Change the boolean value to be able to tweak it. Doing it with a direct Havok call will make your code not compatible with newer Havok .wasm (potentialy) or another Physics Engine.