Blender Asked by Utkarsh Singh on October 24, 2020
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)
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.
Correct answer by Rich Sedman on October 24, 2020
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?
Answered by moonboots on October 24, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP