pmndrs / react-three-rapier

🤺 Rapier physics in React
https://react-three-rapier.pmnd.rs
MIT License
1.05k stars 58 forks source link

Breaking changes to setAngvel on RigidBody? #675

Closed arvinwallace closed 4 months ago

arvinwallace commented 4 months ago
// v-1.3.1
setAngvel(A2, I2) {
  let g2 = wA.intoRaw(A2);
  this.rawSet.rbSetAngvel(this.handle, g2, I2),
  g2.free();
}

// v-1.1.2
setAngvel(A2, I2) {
  let g2 = DA.intoRaw(A2);
  this.rawSet.rbSetAngvel(this.handle, g2, I2),
  g2.free();

I bring this up because I'm working through the "Physics" tutorial from WAWA and the left/right controls on the player's rotation no longer work with the latest rapier version.

arvinwallace commented 4 months ago

This is a better question for Wawa to explain.

arvinwallace commented 4 months ago

I see the issue now. in v-1.1.2 the "lockRotations" prop in the RigidBody did not prevent "setAngvel" from changing the rotation of the player-Y axis inside UseFrame. In the latest version of Rapier, "lockRotations" does indeed lock the rotations (no matter what happens with setAngvel) ss it should and probably as intended.

So in other words, if you make a mistake (like in that physics tutorial) and leave "lockRotations" on accidentally, you will not pay a price for it in the older version. The latest version enforces correct behavior as it should.