qqqzp Posted March 25, 2020 Share Posted March 25, 2020 Hi everyone. I am new to Pixi.js and I took a project about optics simulation. I was planning to use Pixi.js to implement a effect like the pic below.When the angle of the flashlight changes, the lazer sweeps over the canvas and sometimes reflected by a mirror or optical lens. But I found a trouble that I can't tell where the ray will interact with other items, thus make it hard to draw a line without a certain end.? So I was hoping someone could tell how can I draw a ray with just one start and a certain angle, or maybe there is any easier way to impliement it. Much thanks for any answers. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 25, 2020 Share Posted March 25, 2020 > But I found a trouble that I can't tell where the ray will interact with other items, thus make it hard to draw a line without a certain end.? PixiJS has very limited options for physics and 2d math in general. It only has affine transforms and rectangular bounds. If you calculated coords - just fill up "PIXI.Graphics" with your lines. Do you have any experience with p2, matter and other physics engines that have raytrace function in them? Connect one of them and use it. In case of "p2" I can warn you that you have to build it from github repo, dont use it from npm. That's all I have regarding your information. 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.