dacatchman

Members
  • Content Count

    29
  • Joined

  • Last visited

  • Days Won

    1

dacatchman last won the day on September 25

dacatchman had the most liked content!

About dacatchman

  • Rank
    Member

Recent Profile Visitors

551 profile views
  1. Bumping because I updated this. Mainly, a new live demo can be found here: https://dacatchman.github.io/pixi-planckjs-demo/ Added toggles for bullet physics, interpolation, and the timestep tweaking. Also, added triangle shapes so you can see how to roll custom shapes for Box2d. Has more aggressive culling for timestep panic as well. Future updates may include custom shape file loading from PhysicsEditor, I wrote a custom json exporter for it that works nicely with planck (well any box2d really) and PIXI. Just depends how far along I keep pushing my personal projects.
  2. Will we get a camera or projection class native to PIXI at any point in the future, or is the PIXI team satisfied with that being an addon?
  3. I made this. Tips welcome of course, was a quick hack, but wanted to help people always asking for physics https://github.com/dacatchman/pixi-planckjs-demo
  4. Check out mainloop.js, there's a neat write up on it and constructing better main loops for javascript. Even has frame interpolation, if that would suit you. Also has some ways of dealing with lost focus and trimming delta time based on being tabbed out. setInterval for a gameloop is not ideal. Either case tabs and lost focus are part of our life in the html5 scene, so it's just coping with it best you can, there is no fix; only mitigation
  5. If I understand correctly, you're just struggling with how PIXI works, conceptually? So, when you do stuff yourself at a lower level (canvas, maybe), you have to specifically call "draw this here" for everything you want to appear on screen. Consider that PIXI does this for you, this is why you're here, right? PIXI is a rendering library, and it renders what you tell it to, based on how you assemble your scene. And how one assembles their scene is quite personal -- there are several ways to approach it. Conceptually, you are loading stuff in advance, instancing it where it needs to be, and then telling it to be in the render pipeline or not. You probably shouldn't be calling render directly on any given Sprite, unless you have a specific reason to be. Don't quote me, but doing so would probably circumvent PIXI's vertex batching and other internal optimizations. Containers are a big part of how PIXI works, and at the same time, they help you organize your scene logically (draw this "sprite layer" before this one, etc). Not just that you could, but you should. It's two birds with one stone. You need to tell PIXI what to render, so thus, you only add stuff it needs to. It doesn't really increase memory usage, certainly not to the degree that loading new graphics would. It's fairly trivial stuff. If you want that simplicity just to get things going then sure, just add everything to PIXI.Application.stage via the appendChild method. If this is a learning project for you to figure out how to make a tile editor work, then you can't really get around this stuff. This is the whole point. Otherwise, why not just use Tiled or some other map maker and a full fledged game engine to do all the thinking for you (phaser, impactjs, etc) ? Now, if you're hung up on how PIXI works and want it to be a little more familiar to something like using plain canvas, then you should avoid PIXI.Application and roll your own mainloop. In this case, you spawn a new PIXI.Renderer, make a PIXI.Container (a scene to draw), call a bunch of new PIXI.Sprites based on textures you've loaded, and myScene.appendChild(sprite). Then call RAF on your animate function and go to town. Here's an example of that, if that's what you're after: https://github.com/pixijs/pixi.js/wiki/v5-Custom-Application-GameLoop Otherwise, based on examples, the out of box behavior of PIXI is to use PIXI.Application which has its own render loop and you bind your own update function to it's update ticker. If that's confusing you, build it up yourself with the above link. But keep in mind, pixi is a batch renderer for the most part. You put stuff in a container, and then it appears on screen. You wouldn't need to step over a tilemap in that traditional way to call draw on each sprite. You'd instance them into memory and set their position, and then later (as they need to be seen) add them to a container that is being rendered. Am I missing your issue...?
  6. Haha. It's hard in text to see humor, especially across speakers of different languages. I am often seen as rude in text, but I'm usually just thinking outloud and wondering, not trying to bother anyone, but somehow doing just that. I'm quick to apologize for that reason =D Thanks again
  7. I actually like that about PIXI, I just wanted a fast drawing lib with not a ton of addons -- not all that easy to find actually. Using defineProperties is a good suggestion I hadn't thought of, thanks. For what it's worth, I wasn't trying to start problems or offend anyone, I was trying to ascertain if it was intended or a bug. My apologies.
  8. So to answer about other engines, matter.js does, phaser does. These are just some I looked at recently. PIXI is the oddity in my mind, but I don't play with engines all that often; the behavior was unexpected from me and so I was just curious if there was some use case I missed. I never used flash or action script, but those are dead now right? Background isC/C++ mostly. Thanks for replying, appreciate it.
  9. The code was provided, take a display object (container, sprite) and increment it's rotation indefinitely (see first line of OP). Then access the rotation property. The value is nonsensical. It's less of a coding question and more of a philosophical one? I mean this is a 2d library, according to itself. What use is rotation, declared in radians, past 2pi ? I mean normally we'd discuss negative radians, some people are all about -pi to pi, others may want 0 to 2pi. I get that discussion, you'd just use whatever the designer chose. But I don't understand this use case. Do people count how many times objects rotate? So you're telling me that's the normal use case, rather than me having to normalize/track my own rotations with an OpenGL library that internally uses a rotation matrix anyhow? heh. What purpose does it serve other than to (wildly unlikely) cause an Number overflow? Anyway, I don't mind doing it myself, it's just weird I have to... because reasons. I am curious what those reasons are, from a design standpoint. Maybe I'm just missing something, which is fair, so anyone, please correct me on that. Otherwise, I feel like this is just one of those oddities new users have to come across and cope with, when probably, they shouldn't have to.
  10. If I just increment rotation (container.rotation +=1*dt) it increases indefinitely (ie: its not in radians), but it's listed as radians in the docs. It seems to just be a setter? How do I get the actual rotation of my object, and why is it obfuscated in such a fashion? Even inspecting the object and diggin into the matrix shows invalid rotation values. Right now I'm constraining it myself to radians, but that seems out of sorts (it changes nothing, except the value, anyhow). Obviously, internally, Pixi does this on its own, just curious where the real values are to use. I mean if I want to do vector math what am I supposed to do with a "radian" value of 2500 ?
  11. dacatchman

    Video

    Thanks for the reply. In Chrome v76, I am getting this randomly when using videos: Sometimes it happens, sometimes it doesn't. Just sitting there refreshing the page sometimes the video plays and other times I get those errors in the console and no video. Any ideas?
  12. dacatchman

    Video

    Okay, small update. I figured that I could access the HTML video object directly by going down the object chain, which I can, ie: mySpriteVideo._texture.baseTexture.source.play(); Generally we treat _variables as private, so it feels wrong to do it this way; any other ideas? This can't be what the developers of PIXI intended? Any reason we can't get a PIXI.Video with frame control on it?
  13. dacatchman

    Video

    So older pixi had a movieclip, but newer docs show to use AnimatedSprite. Problem is, the construct an animated sprite we need an array of textures. However, all the demos for v4 and v5 for video are just PIXI.Texture.from('path/to/video') and it makes a new texture/sprite each time the video would play. I'm interested in using the animatedSprite loop/gotoAndPlay methods because I'm trying to show videos on demand. Any ideas? I'm quite new to PIXI so it's innards and how to get like, the frames of a Texture and such, are a mystery to me. Thanks!
  14. Thanks Drhayes. Still new to Phaser so this one tripped me up.
  15. It's been a long day and I might just be overlooking the basics, but this seems wrong to me for some reason. var MyClass = function() {var self = this;this.game = new Phaser.Game(1024, 768, Phaser.AUTO, 'game', {preload:this.preload});}MyClass.prototype.constructor = MyClass;MyClass.prototype.preload = function() {console.log(this); // <--- Phaser.Game, not MyClass}var app = new MyClass();