Closed 8Observer8 closed 1 year ago
Hi Ivan, I tried these steps and getting the previous issue I opened #56.
Here's what works for me with your steps, installing the previous version of v1.2.3
and using the named export of oimo
.
npm i saharan/OimoPhysics#v1.2.3
import { oimo } from 'oimophysics';
const world = new oimo.dynamics.World();
world.gravity = new oimo.common.Vec3(0, -9.8, 0);
console.log(world.gravity);
A good reference for how to use the JavaScript module is the three.js example by @VBT-YTokan, which includes an export wrapper for the OIMO.*
syntax.
https://threejs.org/examples/physics_oimo_instancing.html https://github.com/mrdoob/three.js/blob/dev/examples/jsm/physics/OimoPhysics.js https://github.com/mrdoob/three.js/blob/dev/examples/jsm/libs/OimoPhysics/index.js
Hi! Thank you very much! It works!
But it looks like 1.2.2 has been installed instead of 1.2.3:
But I think it doesn't matter.
Ah, you're right. It's a mistake in that release though, it is v1.2.3
but the package.json
wasn't updated.
https://github.com/saharan/OimoPhysics/blob/v1.2.3/package.json#L3 https://github.com/saharan/OimoPhysics/blob/297090ff00847f7a6cefbacd114388477b338b7a/package.json#L3
I installed the last 1.2.4 version and it works!
npm i saharan/OimoPhysics#v1.2.4
app.js
import { oimo } from "oimophysics";
const world = new oimo.dynamics.World();
world.gravity = new oimo.common.Vec3(0, -9.8, 0);
console.log(world.gravity);
node app.js
Output: oimo_common_Vec3 { x: 0, y: -9.8, z: 0 }
I tried these steps and getting the previous issue I opened https://github.com/saharan/OimoPhysics/issues/56.
Thanks for the useful information. I'll keep it on mind.
Hi @8Observer8, I should add that we were setting the gravity incorrectly in these tests, essentially you were just setting the property gravity
and reading it back on the next line.
To get and set the gravity in OimoPhysics you use getGravity()
and setGravity(gravity)
, so for example:
import { oimo } from "oimophysics";
const world = new oimo.dynamics.World();
world.setGravity(new oimo.common.Vec3(0, -9.8, 0));
console.log(world.getGravity()); // oimo_common_Vec3 { x: 0, y: -9.8, z: 0 }
And I should also add that the gravity is already set to -9.80665
by default.
import { oimo } from "oimophysics";
const world = new oimo.dynamics.World();
console.log(world.getGravity()); // oimo_common_Vec3 { x: 0, y: -9.80665, z: 0 }
Thank you very much!
I tried these steps and getting the previous issue I opened https://github.com/saharan/OimoPhysics/issues/56
I ran a physics loop on the server side and I have the same error:
file:///E:/_Projects/node_modules/oimophysics/bin/js_modules/OimoPhysics.js:17879
let st = HxOverrides.now() / 1000;
^
ReferenceError: HxOverrides is not defined
at oimo_dynamics_World.step (file:///E:/_Projects/node_modules/oimophysics/bin/js_modules/OimoPhysics.js:17879:12)
at ServerGameCore.<anonymous> (file:///E:/_Projects/Physics/OimoPhysics/multiplayer-ws-oimophysics-webgl-rollup-js/src/server/server-game-core.js:93:24)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
Using of 1.2.3 instead of 1.2.4 is the solution.
I completed the first version of the demo with an authoritarian server, where you can navigate in cooperative and single player modes from the first and third person. Made to show models, animations made in Blender and interactive interactions on WebGL. Demo in browser: https://8observer8.github.io/webgl10-js/room-webgl-js/
Hello. I will describe my steps. Please, write what step is wrong.
I created a new folder and the
package.json
file using this command:I installed the engine:
I added
"type": "module"
to thepackage.json
file:I created the
src/server/app.js
file:I tried to run
app.js
withnodemon src/server/app.js
but I had this error: