Giter VIP home page Giter VIP logo

Comments (2)

donmccurdy avatar donmccurdy commented on July 28, 2024

Expected breaking changes

  • remove physics from aframe-extras, or deliver only local driver
  • remove support for kinematic-body
  • default shape to box, not trimesh

from aframe-physics-system.

wmurphyrd avatar wmurphyrd commented on July 28, 2024

This is going to be great for performance!

Regarding collisions, physics-collider loops through the world contact equations and used references to the collider's body object and the other bodies' references to their elements. Since we'll no longer have access to body references from the scene nor entity references from the physics worker, perhaps return a map of colliding object IDs

// in the physics worker
var collisions = {};
world.contacts.forEach( contact => {
  let bodID1 = bodyToIDWeakMap.get(contact.bi), // a WeakMap global in the service worker
    bodID2 = bodyToIDWeakMap.get(contact.bj);
  if(collisions[bodID1]) { collisions[bodID1].push(bodID2); } else { collisions[bodID1] = [bodID2]; }
  if(collisions[bodID2]) { collisions[bodID2].push(bodID1); } else { collisions[bodID2] = [bodID1]; }
});

// and in client components
var collisions = this.el.sceneEl.systems.physics.data.state.collisions,
  IDMap = this.el.sceneEl.systems.physics.IDToEntityMap;
var myCollidedEntities = collisions[IDMap.get(this.physicsBodyID)] && 
   collisions[IDMap.get(this.physicsBodyID)].map(IDMap.get);

My wishlist for the API would be some way to update the physics body shapes for changes in scale from super-hands stretchable

Edit: fixed bad syntax in the example code

from aframe-physics-system.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.