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

feat: rigid body continued #18

Merged
merged 22 commits into from
Sep 4, 2024
Merged

Conversation

Neosoulink
Copy link
Collaborator

@Neosoulink Neosoulink commented Jun 13, 2024

About this PR

This PR adds some missing Physics support and some tiny documentation refactoring.

Change logs

  • feat: rigid-body instance Matrix compose support | 5998f29
    • Add instancedMesh rigid-body position support
    • Add instancedMesh rigid-body rotation support
    • Make createRigidBody export the received object
      • Add CreateRigidBodyReturnType
    • Make createCollider export the received object
      • Add CreateColliderReturnType
  • feat: base of instancedMesh support | d68dd43
    • Add reusable constants (EULER_ZERO, QUATERNION_ZERO, MATRIX_ZERO)
    • Make RigidBody component accept instanced boolean property
    • Handle instanced Mesh case from RigidBody component
  • feat: add hull collider | 3b366f6
    • Add hull case to createColliderDesc (convexHull colliderDesc support)
      • Add hull to ColliderShape type
  • feat: delegate responsibilities to sub-utils | 8412712
    • Add createRigiBody util
      • Add CreateRigidBodyProps type
    • createRigidBodyDesc need an object now
      • Add CreateRigidBodyDescProps type
    • createColliderDesc need an object now
      • Add CreateColliderDescProps type
    • Add createCollider util
      • Add CreateColliderProps type
    • Add createColliderFromChildren util
      • Add CreateColliderFromChildrenProps type
    • Map received children colliders and update their states
  • refactor(architecture): better structure separation | 9441602
    • Move vue components at ./src/components/
    • Move all types/interfaces at ./src/types
      • Add RigidBodyType type (containing the supported rigidBodyDesc types)
      • Add RigidBodyProps interface
      • Add InjectableRapierContext interface
      • Add PhysicsProps interface
      • Add ColliderShape type
    • Move helper/utils at ./src/utils/
      • Rename createColliderDesc to createColliderDesc, and return a ColliderDesc
      • Rename createRigidBody to createRigidBodyDesc and return a RigidBodyDesc
    • Add a ./src/constants/ sub folder
  • refactor: better access to rapier context | bfde220
    • Correct world step usage
      • Correctly update the timestep
    • Use a correct type for useRapierContext
    • Improve methods documentation
  • feat: add trimesh support | 96cd52a
    • Uncomment & implement trimesh support
    • Add heightfield todo comment
  • chore(config): correct vite configuration | f574732
    • Add missing name & description from package.json
    • Format vite config file

Records

Multiple objects in one body

record-1.mov

Instacend Mesh

record-2.mov

Note that some other change was made for configuration or documentation into the package.json. Minor changes

kekkorider and others added 10 commits November 13, 2023 14:43
### Desccription

- Add missing `name` & `description` from package.json
- Format vite config file
### Description

- Uncomment & implement `trimesh` support
- Add `heightfield` todo comment

Co-Authored-By: Alvaro Saburido <[email protected]>
### Description

- Correct `world` step usage
  - Correctly update the `timestep`
- Use correct type for `useRapierContext`
- Improve methods documentation

Co-Authored-By: Alvaro Saburido <[email protected]>
@Neosoulink
Copy link
Collaborator Author

Hey @alvarosabu,

I'm planning to list the needed features and share them with you as discussed,
Surely we will have to create new Issues and PR in the next coming days

@Neosoulink Neosoulink changed the title Feat | Rigid body continued feat: rigid body continued Jun 13, 2024
Neosoulink and others added 2 commits June 18, 2024 01:02
### Description

- Move `vue` components at `./src/components/`
- Move all types/interfaces at `./src/types`
  - Add `RigidBodyType` type (containing the supported rigidBodyDesc types)
  - Add `RigidBodyProps` interface
  - Add `InjectableRapierContext` interface
  - Add `PhysicsProps` interface
  - Add `ColliderShape` type
- Move helper/utils at `./src/utils/`
  - Rename `createColliderDesc` to `createColliderDesc`, and return a `ColliderDesc`
  - Rename `createRigidBody` to `createRigidBodyDesc` and return a `RigidBodyDesc`
- Add a `./src/constants/` sub folder

Co-Authored-By: Alvaro Saburido <[email protected]>
### Description

- Add `createRigiBody` util
  - Add `CreateRigidBodyProps` type
- `createRigidBodyDesc` need an object now
  - Add `CreateRigidBodyDescProps` type
- `createColliderDesc ` need an object now
  - Add `CreateColliderDescProps ` type
- Add `createCollider` util
  - Add `CreateColliderProps` type
- Add `createColliderFromChildren` util
  - Add `CreateColliderFromChildrenProps` type
- Map received children colliders and update their states
@Neosoulink Neosoulink self-assigned this Jun 18, 2024
### Description

- Add `convexHull` colliderDesc support
### Description

- Add `instancedMesh` rigid-body position support
- Add `instancedMesh` rigid-body rotation support
- Make `createRigidBody` export the received `object`
  - Add `CreateRigidBodyReturnType`
- Make `createCollider` export the received `object`
  - Add `CreateColliderReturnType`
@Neosoulink Neosoulink added rigid-body physics documentation Improvements or additions to documentation enhancement New feature or request labels Jun 23, 2024
@Neosoulink
Copy link
Collaborator Author

Today I tried to implement the heightfield collider but couldn't do it as the mentioned limitation discussed before is still blocking me.

I'll wait for a review before continuing.
Even if this PR looks big, it's just a small piece of what can be implemented.

I limited myself only to RigidBody basics.
Here's a list of what may be implemented in the future:

Support for all the collider shapes.

We should implement more colliders like:

  • ConvexMesh
  • Heightfield
  • Polyline
  • RoundCone
  • RoundConvexHull
  • RoundConvexMesh
  • RoundCuboid
  • RoundCylinder

Joints support

<<One of the most appealing features of a physics engine is to simulate articulations. Articulations, aka. joints...>>
See https://rapier.rs/docs/user_guides/javascript/joints

More props and Events management

Providing users with a way to connect to Rapier events efficiently will be interesting. Actually RigidBody component provides only a few basic properties, and none of them are related to events, especially to collision-detecttions...

Add a Collider Component

In our current case, all the Physics feature is based on the RigidBody component. It's okay but what if users want to have more controllers over the Collider only?

It will not make sense to access Collider Properties from the RigidBody component.
Or only use RigidBody without Collider...

Etc...


Rapier is huge and provides hundreds of amazing features.
In this PR I focus mostly on basics and code quality! Having a good start, clean code and clean architecture is a great start in my opinion.

As I said, I'll not continue on this PR until review, hope this contribution will please you.
Cheers

cc: @alvarosabu

@alvarosabu
Copy link
Member

Hi @Neosoulink thanks for the contribution, I will go over it this week

@alvarosabu alvarosabu added the p3-significant High-priority enhancement (priority) label Jun 29, 2024
Copy link
Member

@alvarosabu alvarosabu left a comment

Choose a reason for hiding this comment

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

Hi @Neosoulink it looks great already, thanks a lot, I tested it locally and works like charm.

There are some minor naming convention topics on the review (file redundant suffixes) + some types missing. The first one is basically to keep a standard within the ecosystem naming conventions.

Let me know if you have any questions.

src/constants/object.constant.ts Outdated Show resolved Hide resolved
src/constants/physics.constant.ts Outdated Show resolved Hide resolved
src/types/collider.type.ts Outdated Show resolved Hide resolved
src/types/physics.type.ts Outdated Show resolved Hide resolved
src/types/rapier.type.ts Outdated Show resolved Hide resolved
src/types/rigid-body.type.ts Outdated Show resolved Hide resolved
src/utils/collider.util.ts Outdated Show resolved Hide resolved
src/utils/rigid-body.util.ts Outdated Show resolved Hide resolved
src/components/RigidBody.vue Outdated Show resolved Hide resolved
src/components/RigidBody.vue Outdated Show resolved Hide resolved
### description

- Remove redundant suffixes
- Add missing types to callbacks params

Co-Authored-By: Alvaro Saburido <[email protected]>
@Neosoulink
Copy link
Collaborator Author

Hey @alvarosabu, the requested changes were made ✨

@Neosoulink
Copy link
Collaborator Author

@alvarosabu, I just merged the last changes from main

This branch is now ready, can can we merge it?

@JaimeTorrealba
Copy link
Member

Hey @alvarosabu I would like to make some work here, but I notice this PR. Can you provide me with access?.
Also could we merge this one?

@alvarosabu
Copy link
Member

There are some merge conflicts still. @JaimeTorrealba

@Neosoulink
Copy link
Collaborator Author

Oh let me resolve them @alvarosabu @JaimeTorrealba, I wasn't aware of that

@Neosoulink
Copy link
Collaborator Author

I always prefer rebasing code from main branches but this one was too behind so I just merged code from main.

I also updated this PR description adding records to see a bit how it looks.

cc: @alvarosabu @JaimeTorrealba

@JaimeTorrealba
Copy link
Member

That's an excellent work @Neosoulink.

@JaimeTorrealba JaimeTorrealba changed the base branch from main to feat/rigid-body September 3, 2024 19:55
@Neosoulink
Copy link
Collaborator Author

Thanks, @JaimeTorrealba and please don't hesitate to reach me for any updates

I see you changed the base, are you currently working on this branch?

@JaimeTorrealba JaimeTorrealba changed the base branch from feat/rigid-body to main September 4, 2024 13:36
@JaimeTorrealba
Copy link
Member

Not really, that was a mistake (I was using GitHub in my tablet I pressed something hehe, sorry)

@Neosoulink I'll contact you by discord if you don't mind.

@JaimeTorrealba JaimeTorrealba merged commit b06eea8 into main Sep 4, 2024
4 checks passed
@Neosoulink
Copy link
Collaborator Author

Sure 😀, I'll appreciate sharing there

@Neosoulink Neosoulink deleted the feat/rigid-body-continued branch October 7, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request feature p3-significant High-priority enhancement (priority)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants