mgear-dev / mgear4

mGear v.4.x.x (python 3 ready) https://mgear4.readthedocs.io
MIT License
266 stars 94 forks source link

Add spring node gravity and simple collision #94

Closed miabrahams closed 2 years ago

miabrahams commented 2 years ago

Issue #58

Gravity sets a target bias in the -y direction.

Add support for a ground plane collider and a list of spherical colliders. The ground plane prevents the spring from crossing below y=0.

Spherical colliders repel the springs from a point in space.

To create a geometrical UI for the collider, create a NURBS sphere, connect its world space position to the input position, and its world space scale to the collider radius.

Collision can be given a softness value to create soft or hard collisions. Zero softness prevents springs from crossing the barriers entirely.

miquelcampos commented 2 years ago

Hello @miabrahams Thanks for the PR! Can I ask you for a big favor? Can you do the PR but instead of modifying the original spring node, create a new one? maybe we can call it "springGravityNode.cpp" Later I will do that optional in the components as an option. The main reason is that @hulud75 just has updated the Rumba contra part mGear solvers with the spring node, if we change it now we will break compatibility 😅 https://github.com/MercenariesEngineering/mgear_solvers_rumba It is not possible for you to do it. I will do it by hand from your PR 😄 About the Node ID: don't worry just add one random ID and I will update it later. Thanks!!!

miabrahams commented 2 years ago

Hi Miguel, that's no problem. I also added a custom gravity direction and ground plane orientation because why not.

https://user-images.githubusercontent.com/10999400/152655179-50feb275-7b0f-4ef6-83e5-5c537ad17827.mp4

miquelcampos commented 2 years ago

Thanks a lot! @miabrahams 😄

hulud75 commented 2 years ago

Hello @miabrahams Thanks for the PR! Can I ask you for a big favor? Can you do the PR but instead of modifying the original spring node, create a new one? maybe we can call it "springGravityNode.cpp" Later I will do that optional in the components as an option. The main reason is that @hulud75 just has updated the Rumba contra part mGear solvers with the spring node, if we change it now we will break compatibility sweat_smile https://github.com/MercenariesEngineering/mgear_solvers_rumba It is not possible for you to do it. I will do it by hand from your PR smile About the Node ID: don't worry just add one random ID and I will update it later. Thanks!!!

Hi ! Please do not worry about the Rumba port in your design choice. For sure, it's good for the mgear users if you do not break the compatibility with previous Maya versions, but regarding the Rumba port, we will simply follow your modifications, no worries.

miquelcampos commented 2 years ago

@miabrahams finally doing the merge! Thanks again for the PR!