Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Downloads

  • physics boost addon script.zip

Missing 1 full-res photo, 1 file, as this post has not yet been imported.

Content

Yup I used chatGPT to make an addon for faster simulations in Blender!

It provides much faster simulations, and replaces loads of manual work with just 1 click.

I actually had to fight 8 hours with chatgpt to make it work properly lol.


In the attachments you can download the text to copy-paste in Blender as mentioned in the video (its a text file, so probably windows will alert you that it might be a virus, but I ensure you that its not lol )

Files

Previews only

Physics Boost Addon - a 1 click tool made in ChatGPT for faster simulations

How it works: - select multiple objects - copy-paste the text below in the scripting panel of Blender - press the "run script" button. Here is the script: import bpy # Get the selected objects selected_objects = bpy.context.selected_objects # Create a collection if it doesn't exist collection_name = "Proxies rigid bodies by RaffoVFX" if collection_name not in bpy.data.collections: new_collection = bpy.data.collections.new(collection_name) bpy.context.scene.collection.children.link(new_collection) # Create a list to store the cubes cubes = [] # Iterate through each selected object for obj in selected_objects: # Create a cube bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=obj.location) cube = bpy.context.active_object cubes.append(cube) # Scale up the cube in Edit mode bpy.context.view_layer.objects.active = cube bpy.ops.object.mode_set(mode='EDIT') bpy.ops.transform.resize(value=(500, 500, 500)) # Switch back to Object mode bpy.ops.object.mode_set(mode='OBJECT') # Set the viewport visibility of the cube to "wireframe" cube.display_type = 'WIRE' # Add a Subdivision Surface modifier subdivision_modifier = cube.modifiers.new(name='Subdivision', type='SUBSURF') subdivision_modifier.levels = 1 subdivision_modifier.render_levels = 1 # Add a Shrinkwrap modifier shrinkwrap_modifier = cube.modifiers.new(name='Shrinkwrap', type='SHRINKWRAP') shrinkwrap_modifier.target = obj # Set the selected object as the target # Set the timeline cursor to frame 1 bpy.context.scene.frame_set(1) # Get the collection collection = bpy.data.collections.get(collection_name) # Move all the objects created by the script to the collection for cube in cubes: collection.objects.link(cube) # Remove the cube from other collections for other_collection in bpy.data.collections: if other_collection != collection and cube.name in other_collection.objects: other_collection.objects.unlink(cube) # Remove the cube from the scene collection if cube.name in bpy.context.scene.collection.objects: bpy.context.scene.collection.objects.unlink(cube) # Disable render visibility for all objects in the collection for obj in collection.objects: obj.hide_render = True # Apply scale and rotation, set origin to geometry, and apply modifiers for obj in collection.objects: bpy.context.view_layer.objects.active = obj bpy.ops.object.transform_apply(location=False, rotation=True, scale=True) bpy.ops.object.origin_set(type='ORIGIN_CENTER_OF_MASS', center='BOUNDS') # Apply modifiers in the specified order for modifier in obj.modifiers: if modifier.type == 'SUBSURF': bpy.ops.object.modifier_apply(modifier=modifier.name) for modifier in obj.modifiers: if modifier.type == 'SHRINKWRAP': bpy.ops.object.modifier_apply(modifier=modifier.name) # Activate rigid body and set mass based on volume for obj in collection.objects: obj.select_set(True) bpy.context.view_layer.objects.active = obj bpy.ops.rigidbody.object_add(type='ACTIVE') volume = obj.dimensions.x * obj.dimensions.y * obj.dimensions.z obj.rigid_body.mass = 0.001 * volume # Adjust the factor as needed obj.select_set(False) # Reset the selection bpy.ops.object.select_all(action='DESELECT') # Add "Child Of" constraint to the originally selected objects for obj in selected_objects: # Find the corresponding cube with the same location matching_cubes = [cube for cube in collection.objects if cube.location == obj.location] if matching_cubes: matching_cube = matching_cubes[0] bpy.context.view_layer.objects.active = obj bpy.ops.object.constraint_add(type='CHILD_OF') child_of_constraint = obj.constraints[-1] child_of_constraint.target = matching_cube

Comments

JuanVFX

This is awesome! On my journey as a 3D Artist, I hope to become a VFX Artist using Blender. I don't know why I didn't find your content earlier, but it has been a blessing. Thank you for sharing your knowledge.

vacuum_tut

this is so great. i'm so glad i subscribe to you) you're great!) should we expect an upgrade to your car and building destruction courses with this magic script?

RaffoVFX

much thanks! Im definitly not gonna rework the car destruction course, it was the most crazy hard work I ever made haha :) For future simulations, for sure I will always involve this addon side to side with rbdlab, rbc, all simulations btw

vacuum_tut

oh yeah, the course is awesome. you are a genius). thanks again for your tutorials. as soon as i get something finished, i will share it with you on discord)

Light Films

That's insane!!!! I'll be using that today!!