Comments (2)
Hey. As you can see from the code, the dispatchEvent()
is called first, and then the body references are freed.
Lines 868 to 873 in 2824846
You probably are doing something asynchronous in your addEventListener callback, so I suggest you first save bodyA and bodyB in variables and then do the asynchronous bit.
world.addEventListener('endContact', (event) => {
const { bodyA, bodyB } = event
// asynchronous bit, bodyA and bodyB are saved in the variables
})
Also, check out the trigger example, it correctly uses bodyA and bodyB there.
from cannon-es.
Yes that was the issue. Thanks for your help. :)
from cannon-es.
Related Issues (20)
- RaycastVehicle: We have twice call updateWheelTransformWorld in updateWheelTransform(from updateVehicle) and then in castRay
- How can I get a list of bodies touching the line between two vectors?
- getVelocityAtWorldPoint() requires result parameter, despite returning result HOT 1
- Documentation for vectorToWorldFrame() incorrect
- Unknown Force is applied on some vertically stacked cubes on straight plane? HOT 3
- What are indices parameters of CANNON.Trimesh function?
- I added a model, I don't know why there is no physical characteristics
- About the basic parameter units of RaycastVehicle in canon-es
- ConvexPolyhedron isn't working for certain vertices
- The sphere flies away after a few seconds while the tab is not active HOT 1
- Implementation of third person controller. How to prevent character from rotating when moving at an angle to an incline HOT 1
- Event `collide` is only thrown once when stacked objects enter trigger HOT 1
- Make code with examples more accessible
- why the fixed body position is updated? HOT 1
- How to know when world.raycastAll has fully resolved HOT 1
- BUG: RaycastAll fails to detect sleeping and static bodies at expected y position HOT 2
- Request for Soft Body Physics Feature in Cannon-es HOT 2
- Collisions not working consistently with convex polyhedrons
- My ground is Trimesh, and the character is Sphere. The collision result is not very normal
- Weird collision between plane and complex polyhedron HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cannon-es.