Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collision hitbox size fixed #20

Merged
merged 1 commit into from
Jan 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions utils/physicsVisualiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ def execute(self, context):
curveData.use_path = False
curveData.dimensions = '3D'
curveData.resolution_u = 1
curveData.bevel_depth = radius/2
curveData.bevel_depth = radius
if capsule == 0:
curveData.bevel_resolution = 0
pos1 -= direction.normalized() * radius/2
pos2 += direction.normalized() * radius/2
pos1 -= direction.normalized() * radius
pos2 += direction.normalized() * radius
curveData.use_fill_caps = True

# Create spline
Expand All @@ -158,15 +158,15 @@ def execute(self, context):
# Add empty objects at the end of the curve:
capsuleCap1Obj = bpy.data.objects.new('CLH_{}_{}_cap1'.format(p1, p2), None)
capsuleCap1Obj.empty_display_type = 'SPHERE'
capsuleCap1Obj.empty_display_size = radius/2
capsuleCap1Obj.empty_display_size = radius
capsuleCap1Obj.location = pos1.xyz
capsuleCap1Obj.parent = curveObj
capsuleCap1Obj.rotation_euler = rot
clhCollection.objects.link(capsuleCap1Obj)

capsuleCap2Obj = bpy.data.objects.new('CLH_{}_{}_cap2'.format(p1, p2), None)
capsuleCap2Obj.empty_display_type = 'SPHERE'
capsuleCap2Obj.empty_display_size = radius/2
capsuleCap2Obj.empty_display_size = radius
capsuleCap2Obj.location = pos2.xyz
capsuleCap2Obj.parent = curveObj
capsuleCap2Obj.rotation_euler = rot
Expand All @@ -185,15 +185,15 @@ def execute(self, context):
# Create empty sphere object:
emptyObj = bpy.data.objects.new('CLH_{}_{}_[{}]'.format(p1, p2, weight), None)
emptyObj.empty_display_type = 'SPHERE'
emptyObj.empty_display_size = radius/2
emptyObj.empty_display_size = radius
emptyObj.location = (pos1[0], -pos1[2], pos1[1])
emptyObj.show_name = True
clhCollection.objects.link(emptyObj)
else:
# Create empty cylinder object:
emptyObj = bpy.data.objects.new('CLH_{}_{}_[{}]'.format(p1, p2, weight), None)
emptyObj.empty_display_type = 'CUBE'
emptyObj.empty_display_size = radius/2
emptyObj.empty_display_size = radius
emptyObj.location = (pos1[0], -pos1[2], pos1[1])
emptyObj.show_name = True
clhCollection.objects.link(emptyObj)
Expand Down Expand Up @@ -252,4 +252,4 @@ def unregister():
bpy.utils.unregister_class(B2NUpdateCLHVisualization)

del bpy.types.Scene.ClothPhysicsFilepath
del bpy.types.Scene.ClothHitboxesFilepath
del bpy.types.Scene.ClothHitboxesFilepath