• Content Count

  • Joined

  • Last visited

About fort

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks, @RaananW—that clears things up nicely.
  2. Hey! I think this is going to be another one of those, "oh right, it's this" sort of questions, but after tinkering with it for far too long, I figured I'd tap into the brain trust that is this forum. I have a cylinder nested inside Epcot Center an icosphere. Both of these will have a mass of zero. Here's the PG: Move your mouse over the icosphere—the cylinder positions/rotates along the picked facet/normal. Click the icosphere to enable physics and set the impostors starting with the cylinder, then the icosphere. Notice that the icosphere's rotation jumps Here's what I'm wondering: Since these things aren't supposed to move in my scene (since the mass === 0), how could I go about setting up these physics impostors in such a way that would preserve the rotation/position of the icosphere and the cylinder at the moment it's clicked? Also, what if the impostor hierarchy is three+ levels deep? Also wondering: Could the icosphere and cylinder (parent/child) impostors have different restitution and friction values? Thanks!!
  3. @RaananW: thanks for the update! If the rotation must be set after the physics impostor is created, does that break if you serialize/load the scene? I tried to make a PG to test, but it didn't go particularly well.
  4. fort

    FPS using NullEngine

    Okay, cool. That's what I was thinking, but there's nothing like a sanity check. Thanks!
  5. Hey! I'm using NullEngine on a server to check for certain conditions in a physics-enabled scene (using deterministic lockstep). As a simple example, I'm trying to find the specific step ID where a specific ball's y position falls below 0. My question is this: how should I set up the engine/scene/etc. in order to run these server-side simulations at the highest possible fps? Keep in mind that I want to be able to derive a list of step IDs on the server that correspond with specific events (re: ball.position.y < 0), and then have that same exact scene play in a browser with the same exact events matching the same exact step IDs.
  6. fort

    Getting the rotation of facet

    YAS! Thanks @Dad72 and @adam!
  7. Hey guys, I'm thinking there's a really simple answer to this, but I'm currently blanking on it. Basically, I'm trying to position/rotate a cylinder such that it is perpendicular to a given facet. Here's the PG: It looks like it works for facets on part of the sphere (maybe?), but there's clearly something I'm missing. Thanks in advance!
  8. Thanks for the quick reply, @RaananW! I've updated the images in the OP—thinking those were critical in describing my particular issue. Would you mind giving it another look when you get a sec? I'm thinking I may be able to apply your approach by doing the following: Load in the "cabin" mesh Create the primitives used for the cabin's (the five, multicolored boxes) Use the cabin mesh as the parent for the boxes Set the physics impostors for the boxes Would that work? I'm basically trying to get a fairly accurate hitbox on the cabin without the processing cost of its out-of-the-box mesh impostor.
  9. I'm trying to create simple physics impostors for relatively complex models (to create CPU-friendly yet fairly accurate hitboxes). I noticed the scene.createCompoundImpostor method would likely work nicely for this sort of thing, but it was dropped in v3.0. What is the recommended strategy for v3.0? As an example, I'd like to create a hitbox for something like this: ...using an array of primitives, like this: edit: here's another example...
  10. fort

    Bablyonjs & express

    I'm building something similar at the moment. Here's the basic setup: import express from 'express'; import { json, urlencoded } from 'body-parser'; import cors from 'cors'; const app = express(); // this allows us to accept big JSON objects via POST request: app.use(json({ limit: '50mb', parameterLimit: 1000000 })); app.use(urlencoded({ extended: true, limit: '50mb', parameterLimit: 1000000 })); app.use(cors({ origin: '*' })); // this is optional, but I need it for my specific setup app.use('/', express.static('public')); // I'm serving static html/js/css here, which renders the bjs scene'/scene', async (req, res) => { // in your front-end JS, do the following: // 1. Serialize your scene. ex: let sceneAsJSON = BABYLON.SceneSerializer.Serialize(scene); // 2. make a POST request to 'http://[host ip:port]/scene' that includes the serialized JSON you created in step #1 in the body of the request. // // That JSON object (your serialized scene) will show up here in req.body.[your post variable name]. Now you can do whatever you want with it—save to a database, cram it in a .babylon file, etc. // don't forget something to reply to the browser's request res.json({ whatever: 'bacon' }); }); app.listen(3000, function () { console.log('app is listening on port 3000.'); });
  11. @RaananW... @Wingnut... seriously, you guys are the best.
  12. @aWeirdo @Wingnut thanks for the help, and great to know re: physics engine—was definitely under the impression that the playground used CannonJS by default. This matches my observations as well.
  13. @RaananW, Thanks for the quick reply! I'm targeting mobile devices for the app, so I'm not sure if I can afford the mesh impostor, but I'll run some tests. Also, I tried setting the rotation before setting the impostor (PG:, but I'm still seeing the same results.
  14. I'm sure there's probably a really simply explanation for this, and I've certainly put in the requisite time researching and experimenting... but I'm having a hard time getting collisions/physics to work properly with heightmaps. Here's the playground: Basically, the balls fall until a collision, then they slow down, which is working as expected. However, when you uncomment line #25 (`ground.rotation.y = .1;`), it's almost like the mesh rotates, but the physicsImpostor does not. It seems like I recall reading somewhere that you have to use a Quaternion to rotate meshes with impostors, but I can't find that reference for the life of me. Any guidance would be much appreciated!