trsh

Members
  • Content Count

    62
  • Joined

  • Last visited

Posts posted by trsh


  1. 2 hours ago, ivan.popelyshev said:

    Generate 2-5 positions instead of one, take the one that is farthest away from other bunnies.

    Btw, if you want to use tint that make objects lighter and not darker like pixi default, try https://github.com/gameofbombs/pixi-heaven/ , just include "bin/pixi-heaven.js" and use "sprite.color.setDark".

    No thanks, no Tint. Bunnies will be replaced with star textures. I want it as simple as possible. 


  2. 31 minutes ago, ivan.popelyshev said:

    Yeah, and "for (var i = maggotsClone.length-1; i >=0; i--) {" removes the error, like i said. Also, you actually dont need clone that way.

    Its a coding problem, not pixi one.

    Take pen and paper, write all three algorithms down and try to emulate it manually.

    I also recommend this book: https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press/dp/0262033844 , its easy to find free copy in internets. Be grateful I dont give advice to read Knuth ;)

    Yeah, it does fix the error. I still don't understand the problem with array (it's just array with references to objects) and how is that connected with particles container, but I'll try :D later, going line by line with smaller amounts. And will change the logic, so no stars out of screen are not removed, but moved to the beginning again. Thanks again!


  3. 17 minutes ago, ivan.popelyshev said:

    I just told you to calculate scale and position based on something else that you store, 3d position. Please think some time on it before asking more questions, imagine that we have veeeeery slow internet.

    When you give me enough good questions, I'll reply with more answers. Lets batch our discussion like pixi does with sprites ;)

    Deal! Actually I figure it out and my demo will be ready soon. Tank you.


  4. 2 hours ago, ivan.popelyshev said:

    1. code projections and modify ParticleContainer that it works with them
    2. code something simple like you did, sometimes its enough
    3. use threejs PointCloud.

    or you can wait when I code 3d projections for https://github.com/pixijs/pixi-projection and add support to ParticleContainer. Right now its only 2d projections stuff.

    Anyway, simple formulas for projeciton. Im taking it from the head now. Dont think that I'll post complete code with commentaries, I just dont have enough time for that. You have to adjust my solution for your case, dont mind variable names, you can change to what you like it.

    Assume that our center of screen is (0,0), focus distance is "d", and "z" is distance from object to focus plane (z=0 is default).

    
    projPosition.x = position.x * d / (z+d);
    projScale.x = scale.x * d / (z+d);
    

    Dont forget to cut stars that already behind us, and have z < -d + eps, or their X already is too high.

    Same applies to Y.

    If you want to change (0,0) just change top container coords, I assume that you know how pixi transformations work.

    Please dont use "scale.x+=" or something like that, store 3d position and 2d position in different variables. Also dont forget to sort points by Z.


    Sorry, I wont show you my paint mad skillz, just imagine that you have a screen on distance D from you, and point is somewhere at (z+D), and you want to project point on that screen.

     

     

    Ok. Cool tnx. But Object that come near do appear bigger, so have can I live without Scale?


  5. Hi guys. I want to create a effect in PIXI, that looks like first frames in this video -> http://hubblesite.org/video/513/news_release/2006-01 (stars shooting/flying by). What would more experienced PIXI'oniers advice to achieve such effect? Performance is critical, I want it also to work on mobiles.

    For now I'm thinking:

    1) Particle container, that's for sure? Maybe with some 1-3 star sprites?

    2) Projection plane for start movement? Or just calculate it with some custom simple logic?

     


  6. So, I have a text in size 200x50, and wan't to scale it down precisely 2 times (100x25)

    option 1) Scale 0,5. This sucks, as the quality is crewed (more on up-scale, less downscale, but anyways it is..) and I can't afford that in my project.

    option 2) FontSize/2. This sucks as well in my case, because it wont be precisely 100x25.

    So are there any alternative options, so I get the precise size and quality as well? Some kind of scale + re-render, duno?

     


  7. 6 minutes ago, xerver said:

    Depends on your goals and the platforms you have to reach. Doing it in a filter is likely the best way but will only work in WebGL.

    You can do it by just drawing a semi-transparent gradient to a canvas, using that as a texture for another sprite you add as a child to the original sprite. You can even mess with the blendMode to get the desired effect.

    I also Plan for canvas. So filters won't be an option. Do have any example code for your 2rd and 3rd proposal? I did not get it this time.


  8. 51 minutes ago, ivan.popelyshev said:

    Changes in bounds were really big. In this case, you have to update whole stage and not just "sp", otherwise it wont work: "stage.updateTransform()" . v4 knows that it has to update all parents of "sp" before it gets bounds, and updateTransform() isnt required there.

    I think there some another problem, that's Container related