-
Notifications
You must be signed in to change notification settings - Fork 17
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
Added support and integration with 'ammonext' physics. #10
base: master
Are you sure you want to change the base?
Conversation
* Added example Sphere component PhysicsSphere * Added example Plane component PhysicsPlane
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.
Thanks for suggestion! See my comments
app/components/PhysicsPlane.js
Outdated
|
||
import {MeshComponent} from '@whs/core/MeshComponent'; | ||
|
||
export class PhysicsPlane extends Plane { |
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.
Is there a need for PhysicsPlane
, PhysicsSphere
... ?
I mean that they are used only once in code.
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.
BasicComponent
was created to show how to organize a first simple component (similarly to React).
app/components/PhysicsPlane.js
Outdated
constructor(params = {}) { | ||
|
||
params.modules = [ | ||
new PlaneModule({ |
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.
That will overwrite all modules
array. I'd recommend using this.applyModule()
after calling super(...)
.
this.applyModule(
new PlaneModule({
mass: 0
})
);
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.
But, anyway, that's just my suggestion of how to do it properly. For very specific component you can ignore that. But if you want to make your components universal - use the code above.
webpack.config.babel.js
Outdated
@@ -28,6 +28,10 @@ const config = { | |||
}, | |||
{ | |||
test: /\.(glsl|frag|vert)$/, loader: 'glslify-loader', exclude: /node_modules/ | |||
}, | |||
{ | |||
test: /\.wasm$/, |
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've made a commit being more explicit about everything, better for example. I saw your repository at https://github.com/sasha240100/ammojs-build-files |
@alkavan There is no need for wasm (no extra optimization on loading time yet) |
* And improving physics demo with light and jumping ball.
@sasha240100 I've updated the PR. Removed wasm dependency, and Improved the demo. |
It seems ammo physics is not so easy to integrate correctly, what do you think about physics branch?