Zylann / solar_system_demo

Demo of a space game made with Godot and voxels
Other
193 stars 22 forks source link

How is rocks' collisionshapes setup? #7

Closed portwatcher closed 2 years ago

portwatcher commented 2 years ago

I searched the entire project and couldn't find how this array is populated

I use your example code in my own project and it turned out that the rocks on the planet have no collisionshapes, only meshes.

Could you please teach me about this?

PS. Sorry for the interuption for the donation, I recently play Genshin on HK server costing a lot of my USD T^T

portwatcher commented 2 years ago

oh I added a breakpoint in the static_bodies for loop and it was never called which means the array is empty at the first place.

So how the collisionshapes of the rocks are handled? What did I miss? VoxelViewer.requires_collisions are true

Zylann commented 2 years ago

I think I only added rock collisions to the medium-sized ones. I didnt add collisions on pebbles and big rocks. Big rocks dont have collision because I set them up from the mesh only: https://github.com/Zylann/solar_system_demo/blob/8d8a277bc9bae60199a33ee741394e155145ef61/solar_system/solar_system_setup.gd#L312 While medium rocks are setup with a whole scene which have collision shapes in them: https://github.com/Zylann/solar_system_demo/blob/8d8a277bc9bae60199a33ee741394e155145ef61/solar_system/solar_system_setup.gd#L295 I dont recall a strong reason for this, other than testing the two ways of doing things.