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

Physics Materials #1294

Merged
merged 8 commits into from
Aug 5, 2024
Merged

Physics Materials #1294

merged 8 commits into from
Aug 5, 2024

Conversation

fallenatlas
Copy link
Contributor

@fallenatlas fallenatlas commented Jul 25, 2024

Description

Add PhysicsMaterial component which allows to customize the behaviour of physics objects by changing their friction coefficient and bounciness. How the values of each are mixed to determine the value to use in the collision resolution can also be customized by choosing between 4 methods, which are some of the most common methods found online. This is inspired by Unity and Unreal which also do this. What the best is will depend on the use case, so I believe that this is better than only letting 1 method.

What some use (restitution only): https://stackoverflow.com/questions/1678908/applying-coefficient-of-restitution-in-a-collision-resolution-method
Unity: https://docs.unity3d.com/Manual/collider-surfaces-combine.html
Unreal: https://dev.epicgames.com/documentation/en-us/unreal-engine/physical-materials-reference-for-unreal-engine

Checklist

  • Self-review changes.
  • Evaluate impact on the documentation.
  • Add entry to the changelog's unreleased section.

@fallenatlas fallenatlas self-assigned this Jul 25, 2024
@fallenatlas fallenatlas linked an issue Jul 25, 2024 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Jul 25, 2024

PR Preview Action v1.4.7
🚀 Deployed preview to https://GameDevTecnico.github.io/cubos/preview/pr-1294/
on branch gh-pages at 2024-08-05 17:26 UTC

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 37 lines in your changes missing coverage. Please review.

Project coverage is 36.36%. Comparing base (0cd5658) to head (fe467ff).

Files Patch % Lines
...c/physics/solver/penetration_constraint/plugin.cpp 0.00% 20 Missing ⚠️
engine/src/physics/plugin.cpp 0.00% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1294      +/-   ##
==========================================
- Coverage   36.36%   36.36%   -0.01%     
==========================================
  Files         393      393              
  Lines       31434    31467      +33     
==========================================
+ Hits        11432    11442      +10     
- Misses      20002    20025      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fallenatlas fallenatlas added this to the 0.4 - ??? milestone Jul 26, 2024
@fallenatlas fallenatlas force-pushed the 1254-different-physics-materials branch 2 times, most recently from dbaa377 to 749ae95 Compare July 30, 2024 13:43
@fallenatlas fallenatlas marked this pull request as ready for review July 30, 2024 14:02
@fallenatlas fallenatlas requested review from a team and RiscadoA as code owners July 30, 2024 14:02
Copy link
Contributor

@DiogoMendonc-a DiogoMendonc-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@tomas7770 tomas7770 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just a minor observation...

Copy link
Member

@RiscadoA RiscadoA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM! Pointed out some nitpicks, feel free to merge it after resolving those

engine/src/physics/plugin.cpp Outdated Show resolved Hide resolved
engine/src/physics/plugin.cpp Outdated Show resolved Hide resolved
engine/src/physics/plugin.cpp Outdated Show resolved Hide resolved
@fallenatlas fallenatlas force-pushed the 1254-different-physics-materials branch from 0926b64 to fe467ff Compare August 5, 2024 17:26
@fallenatlas fallenatlas merged commit 4268746 into main Aug 5, 2024
11 checks passed
@fallenatlas fallenatlas deleted the 1254-different-physics-materials branch August 5, 2024 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different physics materials
4 participants