Repository: godot
Issue: p_node_index is out of bounds, pinning points on a Softbody
Labels: bug,confirmed,topic:physics,topic:3d

### Godot version

3.4.2.stable.official (45eaa2daf)

### System information

Windows 10 Pro

### Issue description

I am attempting to use a Softbody via bone attachment on an Armature, all imported from Blender. When attempting to pin vertices, only two turn blue... the rest turn a faintly different blue hue. This error is prompted in the output:

```
 modules/bullet/soft_body_bullet.cpp:468 - Index p_node_index = 44 is out of bounds (bt_soft_body->m_nodes.size() = 30).
 modules/bullet/soft_body_bullet.cpp:211 - Index p_node_index = 44 is out of bounds (bt_soft_body->m_nodes.size() = 30).
 modules/bullet/soft_body_bullet.cpp:468 - Index p_node_index = 46 is out of bounds (bt_soft_body->m_nodes.size() = 30).
 modules/bullet/soft_body_bullet.cpp:211 - Index p_node_index = 46 is out of bounds (bt_soft_body->m_nodes.size() = 30)
```
I have attempted to do different export types instead of .glb, such as .obj ... and tinkered with where I exported from. I am unsure of what causes this.

![image](https://user-images.githubusercontent.com/30809120/147135284-4d264e7e-f890-4029-84b6-a47bf3352b03.png)

This shows my order of clicking the pins. The middle points barely change color but are a shade bluer than before. When running the scene...

![image](https://user-images.githubusercontent.com/30809120/147135600-58c48362-9dd7-4298-9a8e-d78bd4d8a64d.png)

These two appear to be pinned... one is correctly placed, the middle three appear to not function and the other pinned seems to have been displaced down to the opposite end of the mesh. The debugger gives this information...

```
E 0:00:00.496   setup_soft_body: Condition "0 > node_index || bt_soft_body->m_nodes.size() <= node_index" is true. Continuing.
  <C++ Source>  modules/bullet/soft_body_bullet.cpp:461 @ setup_soft_body()
E 0:00:00.500   setup_soft_body: Condition "0 > node_index || bt_soft_body->m_nodes.size() <= node_index" is true. Continuing.
  <C++ Source>  modules/bullet/soft_body_bullet.cpp:461 @ setup_soft_body()
E 0:00:00.755   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:00.759   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:00.764   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:00.769   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:00.772   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
```

I was told to try switching to Godot Physics instead of Bullet... When ran, the softbody is completely gone and this is the debug log...

```
E 0:00:00.490   get: Condition "!p_rid.is_valid()" is true. Returned: nullptr
  <C++ Source>  ./core/rid.h:139 @ get()
E 0:00:00.493   body_attach_object_instance_id: Condition "!body" is true.
  <C++ Source>  servers/physics/physics_server_sw.cpp:608 @ body_attach_object_instance_id()
E 0:00:00.785   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:00.791   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:00.798   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:00.803   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:00.809   _update_cache_pin_points_datas: Spatial node not defined in the pinned point, this is undefined behavior for SoftBody!
  <C++ Source>  scene/3d/soft_body.cpp:771 @ _update_cache_pin_points_datas()
E 0:00:02.949   free: Invalid ID.
  <C++ Error>   Method failed.
  <C++ Source>  servers/physics/physics_server_sw.cpp:1278 @ free()
```

I am completely lost as to what is going on, this is my first attempt to use soft bodies. I happened to be following a tutorial video on making cloth-like capes. It seemed I simply needed to add in the mesh and pin the correct points, but instead I have run up into whatever issue this is.


### Steps to reproduce

I was following this video [https://www.youtube.com/watch?v=H3fQbefqsu8](url) ... I only made it to the point of pinning the verts due to this issue.

### For the minimal reproduction project below

I have stripped back everything irrelevant to the issue... the MRP below is at a state where I have already selected the back row of pins, which begins to show the error. When pressing play on the scene... you'll see the pins are displaced or not working at all.

### Minimal reproduction project

[SoftBody_Issue.zip](https://github.com/godotengine/godot/files/7764489/SoftBody_Issue.zip)