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

SoftBody physics overhaul #2893

Merged
merged 16 commits into from Jun 20, 2023
Merged

Conversation

QuantumCoderQC
Copy link
Contributor

This PR is an overhaul of the SoftBody physics on both HL and JS targets.

Fixes #2654 and #1920

Requires armory3d/iron#194 and armory3d/haxebullet#41

  1. For Wrong number of vertices when optimizing mesh export for SoftBody Physics #1920, I export an extra index buffer called vertex_map. This maps Blender's vertex_index attribute to Armory's index buffer. This information was lost at export. This is then used to connect vertices and faces properly at SoftBody initialization.

  2. For Soft Body/Cloth Physics Cause Black Screen #2654, I changed the data type passed to the SoftBody initialization function.

Other fixes/ additions apart from the above two issues:

  • Added support to HL targets: This was done by creating a custom array type to overcome HL to WebIDL constraints on array data types such as this and Question about pointers as params ncannasse/webidl#21

  • Runtime spawning: Since SoftBodies modify an object's mesh data directly, simply "duplicating" the mesh at runtime for a spawn does not give the required result. So, at spawn, a new instance of the data is created and is set as the mesh data for current object. This way, the meshes do not share mesh data and are independent.

  • Adaptively move the SoftBody origin to the mean positions of the vertices. This should improve graphical precision as the SoftBody goes away from the origin. May be used for other game logic such as detection and tracking.

  • Smaller fixes such as enabling Soft-Soft collisions.

Thanks to everyone on Discord for testing the changes and providing valuable feedback and suggestions.

@luboslenco luboslenco merged commit e7cf336 into armory3d:main Jun 20, 2023
@luboslenco
Copy link
Member

Super cool!

@QuantumCoderQC QuantumCoderQC deleted the soft-body-fix branch June 20, 2023 18:02
@MoritzBrueckner MoritzBrueckner added the Release Notes: Fixes A pull request that fixes something. Used to generate release notes. label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Notes: Fixes A pull request that fixes something. Used to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Soft Body/Cloth Physics Cause Black Screen
3 participants