1
$\begingroup$

I created the object by first creating the edges to the curved face with the script below followed by adding a face and then extruding it. I made sure to change the Source property under Collision to Base but still the objects penetrate each other. How do I prevent this? Any help would be much appreciated. It has been too long that I have been struggling with this :(

import bpy
import math
from math import sin, cos, radians, sqrt

# variables
n_verts = 24
profile_radius = 1
section_angle = 240.0 / (n_verts-1) 
z_float = 0.0
Verts = []
Edges = []
Faces = []

# code for bottom face
for i in range(n_verts):
    x_float = cos(-math.pi/6+math.radians(section_angle*i))
    y_float = 1 + sin(-math.pi/6+math.radians(section_angle*i))
    Verts.append((x_float, y_float, z_float))
    
for i in range(1, n_verts):
    x_float = -math.sqrt(3)/2 + cos(math.pi/2+math.radians(section_angle*i))
    y_float = -1/2 + sin(math.pi/2+math.radians(section_angle*i))
    Verts.append((x_float, y_float, z_float))

for i in range(1, n_verts-1):
    x_float = math.sqrt(3)/2 + cos(-5*math.pi/6+math.radians(section_angle*i))
    y_float = -1/2 + sin(-5*math.pi/6+math.radians(section_angle*i))
    Verts.append((x_float, y_float, z_float))

# connect all the edges
for i in range(3*n_verts-3):
    if i == 3*n_verts-4:
        Edges.append([i, 0])
        break
    Edges.append([i, i+1])

profile_mesh = bpy.data.meshes.new("Base_Profile_Data")
profile_mesh.from_pydata(Verts, Edges, Faces)
profile_mesh.update()

profile_object = bpy.data.objects.new("Base_Profile", profile_mesh)
profile_object.data = profile_mesh

scene = bpy.context.scene
scene.collection.objects.link(profile_object)
profile_object.select_set(True)

Frame 1

Frame 50

$\endgroup$
4
  • $\begingroup$ could you please share your file? blend-exchange.giantcowfilms.com $\endgroup$
    – moonboots
    Aug 13, 2020 at 9:47
  • $\begingroup$ hey I have uploaded the file $\endgroup$ Aug 13, 2020 at 9:54
  • $\begingroup$ I'm not an expert enough in Rigid Body, you can fix the problem if you switch from (Shape >) Mesh to Convex Hull but maybe I miss a solution with Mesh $\endgroup$
    – moonboots
    Aug 13, 2020 at 10:16
  • $\begingroup$ hey man, thanks. that helps a LOT! :))) $\endgroup$ Aug 13, 2020 at 10:35

2 Answers 2

1
$\begingroup$

The problem is that the surface Normals are facing inwards and this is breaking the collision.

To resolve this, select each object and go into Edit mode (Tab), select all (A) and select Mesh/Normals/Recalculate Outside. This should re-calculate the normals so that they are consistent with a solid object. Once you have done this for both objects, re-run the simulation and the collision should now be working correctly.

Bad normals enter image description here

Good normals enter image description here

$\endgroup$
1
  • $\begingroup$ hey thanks man :) $\endgroup$ Aug 14, 2020 at 7:59
0
$\begingroup$

You can fix the problem if you go in the Properties panel > Physics > Collisions and you switch the Shape from Mesh to Convex Hull. I hope someone will explain why Mesh fails or if I miss the right settings, it might be because Blender can't deal with too complex topologies?

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .