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

Add convex hull modifier after decimating convex collisions #269

Closed
Weisl opened this issue Nov 4, 2022 · 1 comment
Closed

Add convex hull modifier after decimating convex collisions #269

Weisl opened this issue Nov 4, 2022 · 1 comment
Labels
VHACD4 VHACD features
Milestone

Comments

@Weisl
Copy link
Owner

Weisl commented Nov 4, 2022

image

Is super fast and makes sure that the colliders are still convex. It should be handled by the engine anyway.
OPTIONAL???

@Weisl Weisl added the VHACD4 VHACD features label Nov 4, 2022
@Weisl Weisl added this to the 1.2 milestone Nov 4, 2022
@Weisl
Copy link
Owner Author

Weisl commented Nov 7, 2022

Create geometry nodes modifier with convex hull

import bpy

def geometry_node_group_empty_new():
    group = bpy.data.node_groups.new("Convex_Hull", 'GeometryNodeTree')
    group.inputs.new('NodeSocketGeometry', "Geometry")
    group.outputs.new('NodeSocketGeometry', "Geometry")
    input_node = group.nodes.new('NodeGroupInput')
    output_node = group.nodes.new('NodeGroupOutput')
    output_node.is_active_output = True

    input_node.select = False
    output_node.select = False

    input_node.location.x = -200 - input_node.width
    output_node.location.x = 200

    group.links.new(output_node.inputs[0], input_node.outputs[0])

    return group


if bpy.data.node_groups['Convex_Hull']:
    group = bpy.data.node_groups['Convex_Hull'] 
    
else: 
    group = geometry_node_group_empty_new()
    nodes = group.nodes

    geom_in = nodes.get('Group Input')
    geom_out = nodes.get('Group Output')
    hull_node = nodes.new('GeometryNodeConvexHull')

    group.links.new(geom_in.outputs[0], hull_node.inputs[0])
    group.links.new(hull_node.outputs[0], geom_out.inputs[0])

modifier = bpy.context.object.modifiers.new(name="Convex_Hull", type='NODES')
modifier.node_group = group



Weisl added a commit that referenced this issue Nov 7, 2022
Weisl added a commit that referenced this issue Nov 7, 2022
@Weisl Weisl closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VHACD4 VHACD features
Projects
None yet
Development

No branches or pull requests

1 participant