Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balls fall extremely slowly. #11

Open
5H2 opened this issue Jun 24, 2024 · 3 comments
Open

Balls fall extremely slowly. #11

5H2 opened this issue Jun 24, 2024 · 3 comments
Labels
perf Performance

Comments

@5H2
Copy link

5H2 commented Jun 24, 2024

This project is amazing, I love it but I found the balls to fall, VERY SLOWLY. This could just be me, but it feels as if the balls are falling in slow-motion. I went to /benchmark and found it to not fall slowly at all, but your website, as well as my localhost are both extremely slow.

I'm not sure what I'm talking about, since I have just started learning the languages, and this could be intentional, but I don't know.

Thank you for the amazing project, I love it!

Video example

Apologies for shit quality and cuts, but trying to keep it short, and no this is not slowed down at all.

Untitled.design.1.mp4
@AnsonH
Copy link
Owner

AnsonH commented Jun 25, 2024

Hi @5H2, thanks for stopping by 😄

I'm aware that the website can be slow on mobile devices, but your demo is on a different level of slowness lol

For easier debugging, would you like to supplement a few more info?

  • Which browser and what are the specs of your computer (CPU, GPU, RAM)? I'm curious to know if your computer is a low-end one
  • You mentioned that /benchmark page is not slow. Would you also provide a video so that I can compare the difference?

Huge thanks!

@5H2
Copy link
Author

5H2 commented Jun 25, 2024

Hey!

I am using chrome on a relatively low end computer, I have an Intel i5 and 16GB of RAM. I also tested on my phone, with zero lag, so it is definitely my device, but it's unbearable slow, so I figured I would ask if any optimization was possible, as my computer is able to run most things fine.

Video example 2

Below I will attach a comparison of the regular vs the benchmark

Untitled.design.2.mp4

@AnsonH AnsonH added the perf Performance label Jun 30, 2024
@denzhe22
Copy link

denzhe22 commented Jul 1, 2024

Hey!

I am using chrome on a relatively low end computer, I have an Intel i5 and 16GB of RAM. I also tested on my phone, with zero lag, so it is definitely my device, but it's unbearable slow, so I figured I would ask if any optimization was possible, as my computer is able to run most things fine.

Video example 2

Below I will attach a comparison of the regular vs the benchmark

Untitled.design.2.mp4

image
this.render = Render.create add showPerformance:true,can see fps for matter.js(not web page,because It's has 2 canvas.)

If you want to change prams, Exp:

InitMatterPrams(){
let row = get(rowCount)
let cfg = GConfig.matterCfgJson[row]
if(!cfg){
console.log("dx 没有找到排数的配置", row);
return
}
//空气摩擦力1
let friction_air_per = cfg.friction_air_per
// 弹力设置0.8
this.restitution = cfg.restitution
//密度0.001
this.ballDensity = cfg.ballDensity//0.001
//质量
this.ballMass = cfg.ballMass
// 物体摩檫力0.5
PlinkoEngine.ballFrictions.friction = cfg.friction
// PlinkoEngine.ballFrictions.friction = 0
/**静摩擦力 */
this.frictionStatic = cfg.frictionStatic || 0.5
//球的大小百分比0.8
this.ballRadiusPer = cfg.ballRadiusPer
// 空气摩檫力
PlinkoEngine.frictionAirByRow = {
8: 0.0395 * friction_air_per,
9: 0.041 * friction_air_per,
10: 0.038 * friction_air_per,
11: 0.0355 * friction_air_per,
12: 0.0414 * friction_air_per * 0.9,
13: 0.0437 * friction_air_per * 0.8,
14: 0.0401 * friction_air_per,
15: 0.0418 * friction_air_per,
16: 0.0364 * friction_air_per,
}
PlinkoEngine.ballFrictions.frictionAirByRowCount = PlinkoEngine.frictionAirByRow

this.engineInitInfo = {
  timing: {
    timeScale: 1,
  },
  gravity:{
    x: 0,
    y: cfg.gravity_y,//
    scale: cfg.gravity_scale//0.01 
  },
  velocityIterations:4,//4
  constraintIterations:2,//2
  positionIterations:6,//6
} 

}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf Performance
Projects
None yet
Development

No branches or pull requests

3 participants