Comments (3)
userData is part of the shape associated with the rigidbody. So in your case you won't find it in hit, but in the shape
like shape.userData
.
I know it works, since i integrated OIMO into a game engine and heavily rely on this feature to distinguish "Objects" by not only save the name of a body in the user data but a whole "gameObject".
You can use this shape.userData also in collisionEvents. Be also aware of the fact one body can have multiple shapes attached to them, each shape then has userData.
from oimophysics.
Thank you very much! It works! I even can use my own data name, for example, myUserData
instead of userData
:
platform1Shape.myUserData = { name: "platform1" };
rayCastCallback.process = (shape, hit) => {
console.log(shape.myUserData.name);
};
But I sure that by unspoken agreement, it's better to use the userData
name like in another physics engines.
The documentation on shape has userData
:
But It is strange that it cannot be found by searching the documentation:
from oimophysics.
It is better to search in this file: node_modules\oimophysics\bin\js_modules\OimoPhysics.d.ts
from oimophysics.
Related Issues (20)
- ConeGeometry HOT 1
- add ghost rigid body feature HOT 3
- get rid of heavy build macros
- What materials did you use to develop the physics engine HOT 1
- removeShape (RigidBody.hx) - Error HOT 3
- Failed to build a simple TypeScript example with Browserify HOT 2
- Please, upload a new version to NPM HOT 7
- Please,A new version Vehicle HOT 1
- Inertia of Cone Geometry seems wrong HOT 2
- Uncaught ReferenceError: HxOverrides is not defined HOT 2
- "Hello World" on the server side with OimoPhysics HOT 8
- I can't change gravity in OimoPhysics 1.2.4 HOT 2
- Incorrect behaviour of rigidbodies with high mass HOT 1
- Allow for models? HOT 1
- ConvexHullGeometry.hx - _volume (issue)
- BvhBroadPhase.hx - Memory leak HOT 2
- Bug: RigidBody.setType before addShape makes body not work HOT 1
- How to prevent character from rotating when moving at an angle to an incline HOT 1
- Question: How to change the centre of mass location? HOT 10
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 oimophysics.