GithubHelp home page GithubHelp logo

Pixel perfect collision? about pixi-haxe HOT 4 CLOSED

pixijs avatar pixijs commented on July 22, 2024
Pixel perfect collision?

from pixi-haxe.

Comments (4)

MintPaw avatar MintPaw commented on July 22, 2024 2

@ivanpopelyshev If you queried the pixels directly from the shader, but you could also look at the png file after transforming your point with the matrix from the texture, or cache the bitmap data, or any number of things. I guess I'll be writing that. :/

Most applications need some at least some alpha testing, even for just buttons, and almost all games require it. I'd say this hardly usable without it.

from pixi-haxe.

ivanpopelyshev avatar ivanpopelyshev commented on July 22, 2024 1

Oh, we didnt close this? OK, here's answer for v5: https://github.com/pixijs/pixi.js/wiki/v5-Hacks#pixel-perfect-interaction

from pixi-haxe.

ivanpopelyshev avatar ivanpopelyshev commented on July 22, 2024

WebGL + pixel perfect collision will be very slow thing. I dont think that any GL engine can support it.

from pixi-haxe.

NicolasVereenoghe avatar NicolasVereenoghe commented on July 22, 2024

if I recall correctly, you can generate a bitmap array this way :

`var lModel : Container = "insert your display object reference"
var lCanvas : CanvasRenderer = new CanvasRenderer( lModel.width, lModel.height, { transparent: true});

lCanvas.render( lModel);

var lImageData : ImageData = lCanvas.context.getImageData( 0, 0, lModel.width, lModel.height);`

And so on, you can work on the ImageData instance. This worked for me at pixi 4.0.2, I hope it still works :) You may generate your bitmap datas before you use them, as I believe it's a bit expensive to generate them at the fly ...

from pixi-haxe.

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.