-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔫 Remove autoUpdate option #22
Conversation
Will release 1.0 after this |
@@ -240,7 +239,7 @@ export default function cannonDebugger( | |||
|
|||
let meshIndex = 0 | |||
|
|||
for (const body of bodies) { | |||
for (const body of world.bodies) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering that you only use the world to access the bodies, it seems a bit overkill to bring the entire world into the debugger.
In use-cannon
the world lives in a worker and we don't have direct access to it so it's quite difficult to have this as a requirement for using the debugger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I preferred matching the signature to the original CannonDebugRenderer.
We can just mock the world (like we're doing now) in use-cannon.
@@ -30,13 +30,12 @@ export type DebugOptions = { | |||
scale?: number | |||
onInit?: (body: Body, mesh: Mesh, shape: Shape) => void | |||
onUpdate?: (body: Body, mesh: Mesh, shape: Shape) => void | |||
autoUpdate?: Boolean | |||
} | |||
|
|||
export default function cannonDebugger( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not match what is in the README:
export default class CannonDebugger {
constructor(scene: Scene, world: World, options: DebugOptions): void
update(): void
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're using this pattern because we don't want to expose the private variables, we can switch to a class when we can ship private class fields
Fixes #21
Having an internal raf loop has resulted in being problematic since the wireframe meshes were not in sync with the bodies. Also this behaviour appears to be confusing for cannon.js users.
Moreover, not even
use-cannon
is actually using this feature.Makes sense to remove it completely.
I also went ahead and updated the signature to match the original CannonDebugRenderer.