Giter Site home page Giter Site logo

User Data for Entities about engine HOT 4 OPEN

LeXXik avatar LeXXik commented on May 24, 2024
User Data for Entities

from engine.

Comments (4)

mvaligursky avatar mvaligursky commented on May 24, 2024

Users can easily do this, even though the data would not survive cloning / templates and similar. Purely runtime:

entity.userData = {
   intensity: 10,
   surname: 'citizen'
}

What else do you have in mind?

from engine.

LeXXik avatar LeXXik commented on May 24, 2024

I mean there is no way to do that from Editor. You would first have to search for that entity, identify by tag/name and then add that userData property so it can be used by collision callback or scripts. At the moment we have to process the entities in the scene first, and then add custom fields. Not like it cannot be done - we've been doing it forever, but I feel like it could have been simplified, as in many cases a plain number is enough, but we can't add it via Editor.

function onContact(entity) {
    const isWall = entity.userData === 2;
}

from engine.

mvaligursky avatar mvaligursky commented on May 24, 2024

They can create a script and expose any attributes on it - would that not work?

from engine.

LeXXik avatar LeXXik commented on May 24, 2024

It could. But then it is a whole script component for what could have been a simple primitive.

from engine.

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.