Godot version: 3.0 master
Issue description:
If you create Body and assign for example cube shape to it and then add mesh instance with CubePrimitive. Their sizes don't match, collision is two times as big as cube.
In one hand cube size is (1,1,1) which matches units... but is hard to place on grid.
Collision shape is extends are (1,1,1) and is easy to move with snap ON on the grid.
As a user would expect them match by default, although I don't know which size is better.
Needs discussion.
Steps to reproduce:
Add RigidBody node.
Add CollisionShape to to body.
Add MeshInstance to body.
Assign Cube primitive to MeshInstance node.
Other Collision also don't align. Capsule CollShape is even rotated xD
I think that new primitives sizes and rotations are a bit better because they use proper Godots Units.
Never did this in 3D, but in 2D the extents of a RectangleShape act like its "radius" and not as height/width. That happens since ever and don't think it changed for 3.0.
I can easily adjust the default sizes and layout of the meshes we create to those used by the collision shapes. I think that even makes a lot of sense to do.
My main worry however is the cube. Whomever created the collision shapes must have judged a cube at size 1,1,1 should have the same size as a sphere with radius 1, but that in effect makes the cube sized 2,2,2. That seems wrong to me. I think the sizing used for the primitives makes more sense here.
But that is one feature breaking changes as it will half the size of any cube collision shape.
@akien-mga , @reduz , your thoughts?
Now is the time to break compatibility :) I also agree that it makes sense the way you did it, we should adjust the collision shape size
Also Capsule CollShape is rotated. It might be to math fixes made earlier in whole engine.
Capsule mesh looks as expected. Stands proudly :D
Biggest problem is Cube CollShape true.
@nunodonato that is true :)
@n-pigeon , I'll find some time this week to adjust the orientation of the capsule to match the collision shapes orientation. It's just a matter of swapping the Y and Z axis generating the mesh
@BastiaanOlij
No, no, I think that collision shape orientation should match your capsule xD You got it wrong (or I write hard to understand sentences :D).
Capsule should be standing, it's mostly used for characters
@n-pigeon , no you wrote it right, I just like the path of least resistance :)
@nunodonato indeed, guess i'll be learning how the collision shapes are put together...
@BastiaanOlij xD If you will do this. I will have to make new Issue that capsules in Godot are lazy and should stand up like proper healthy capsule (if you know what I mean). :P
Note that adding a cylinder collision shape would be nice to complete the set (no idea how easy this is but just putting it out there).
FWIW the Vizard 5 engine has primitive shapes that have the default radius of the sphere and the default cube side 1m (so the sphere is quite a bit larger than the cube). Not exactly a gold standard to follow but it makes it easy to scale from there and IMHO is the right way to do it.
I麓m not sure if this is a bug as they are not really meant to be used directly together..
@reduz consistency is nice, other then that I agree with you with one small footnote.
A collision cube of size 1,1,1 is actually a collision cube of size 2,2,2. It doubles the size because it changes it to a cube from -1,-1,-1 to 1,1,1.
Dangerous thing to change though.
Note that I did re-orientate the capsule primitive to match the orientation of the collision shape.
So, the main problem here is the cube? if so we can just change it and that's it.. it's going to break a ton of exported projects from 2.1 unless we somehow do a fix, though
I am still not sure whether this is a bug or not..
It would be nice if it would be consistent. Consistency makes work easier.
But it's not something very important, I must agree on that.
It's not technically a bug more of an enhancement.
@reduz I'm undecided as well. It really just depends on what view you take.
For me, it is the question of what is more important. Consistency or preventing the pain for everyone having to double check their projects. In the end, you quickly notice the collision shape is double the size of the cube, it really isn't hard to adjust the figures.
Hard? No. Irritating? Hell yeah :D
@BastiaanOlij How about changing this on shapes (BoxShape / RectangleShape), but leaving it as is on visual server? I think this makes more sense
So, it's starting to be a bit late to fix this.. Any update? Or should we keep things as is for 3.x?
This will have to be changed eventually in 3.2 (or 4.0), so we can break compat happily and improve grid snapping for 1x1 boxes.
Other Collision also don't align. Capsule CollShape is even rotated xD
I propose that the cube mesh and collider have a default size where the "radius" is 0.5 and the "diameter" is 1, such that a cube with a scale of 15 is exactly 15 units long. This is the behavior in Unity. This would break compatibility, all projects would need to scale up their cube primitives by 2.
Most helpful comment
Capsule should be standing, it's mostly used for characters