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

Game FPS example improved #22506

Merged
merged 9 commits into from
Sep 8, 2021
Merged

Game FPS example improved #22506

merged 9 commits into from
Sep 8, 2021

Conversation

octopoulos
Copy link
Contributor

4 improvements:

  1. Performance with 300 balls on my computer was sub 1 fps, and after the first commit, it jumped to 60 fps.
    This was achieved by doing 3 things:
    a) move sphereCollisions outside the sphere loop => O(n^3) becomes O(n^2), => getting 20 fps about instead of 1 fps.
    b) change collider.clone().center to collider.center.clone() => getting 40 fps;
    c) use temporary Vector3 instead of cloning them => getting 60+fps.

I changed the number of balls from 20 to 100 by default.

  1. Air control: easier to control where to jump and land.

  2. Adjust throw power: if you hold the mouse button, it throws the ball with more force.
    Also, if you move, it impacts the throw a bit, so to throw really far, you want to move forward and hold the button for 2 sec or so.

  3. Basic collision between player and the balls.

@mrdoob
Copy link
Owner

mrdoob commented Sep 8, 2021

Nice!

@mrdoob mrdoob added this to the r133 milestone Sep 8, 2021
@mrdoob mrdoob merged commit e184597 into mrdoob:dev Sep 8, 2021
@mrdoob
Copy link
Owner

mrdoob commented Sep 8, 2021

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants