Sentinel Posted December 5, 2017 Share Posted December 5, 2017 I've taken a look at pixi-viewport and I really like it except for the ease drag part and the fact that it can't return a PIXI.DisplayObject that I can add myself to the stage and render it. t So I have a Pixi.Container I want the camera to move around instead of it inheriting the render and using its own render loop. Basically I want the same result as the Phaser.io Camera Maybe the documentation is just confusing me, but I can't seem to get it to work like I want. Is there any other way to do this? Because I want to have a GUI overlay. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 5, 2017 Share Posted December 5, 2017 Search for "camera" in this subforum, I've made some simple solutions and people commented with their editions. Quote Link to comment Share on other sites More sharing options...
Sentinel Posted December 5, 2017 Author Share Posted December 5, 2017 22 minutes ago, ivan.popelyshev said: Search for "camera" in this subforum, I've made some simple solutions and people commented with their editions. Found what I was looking for. Is there any way I can implement a mouse drag event? So the camera follows the cursor position while dragging, and doesn't when drag has ended. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 5, 2017 Share Posted December 5, 2017 I had that thing buried somewhere. Sorry, its lost. You have to look up all the threads about drag , and take closest solution. Oh, wait, found one: http://pixijs.io/examples/#/projection/basic.js , good example of how to drag and click elements. Dont mind pixi-projection usage. If it doesnt suit you, learn how toLocal/toGlobal and those things work, I'm sure you can find solution. I've used something like that for 2d maps and elements on them before. Quote Link to comment Share on other sites More sharing options...
Sentinel Posted December 6, 2017 Author Share Posted December 6, 2017 1 hour ago, ivan.popelyshev said: I had that thing buried somewhere. Sorry, its lost. You have to look up all the threads about drag , and take closest solution. Oh, wait, found one: http://pixijs.io/examples/#/projection/basic.js , good example of how to drag and click elements. Dont mind pixi-projection usage. If it doesnt suit you, learn how toLocal/toGlobal and those things work, I'm sure you can find solution. I've used something like that for 2d maps and elements on them before. Got it working from the projection example. Thanks a lot for the spoonfeeding ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 6, 2017 Share Posted December 6, 2017 Nice! One more point to that implementation, I'll put it in wiki or cookbook later. Quote Link to comment Share on other sites More sharing options...
Vivraan Posted January 8, 2021 Share Posted January 8, 2021 Sorry for reviving this dead thread, but is modifying the position of the stage of an Application object feasible for this? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 8, 2021 Share Posted January 8, 2021 That's default solution. You can also use "pivot" and not a position. basically, stage.position.set(renderer.screen.width/2, renderer.screen.height/2); stage.scale.set(1.33);//scale it whatever you want stage.pivot.set(myCharacter.x, myCharacter.y); //now character inside stage is mapped to center of screen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.