0
$\begingroup$

I want to create two bodies collision. The two bodies are been animated in order to determine their start and finish positions. The problem is that the two bodies collapse into each other instead of colliding because of the animated mode.

After creating the two objects (and the plane) here is the code I used:

py.data.objects['Cube'].rigid_body.kinematic = True
bpy.data.objects['Cube'].location = [-5,-5,1]
bpy.data.objects['Cube'].keyframe_insert(data_path='location', frame=1)
bpy.data.objects['Cube'].location = [0,0,1]
bpy.data.objects['Cube'].keyframe_insert(data_path='location', frame=20)
bpy.data.objects['Cube'].rigid_body.kinematic = False

bpy.data.objects['Sphere'].rigid_body.kinematic = True
bpy.data.objects['Sphere'].location = [5,-5,1]
bpy.data.objects['Sphere'].keyframe_insert(data_path='location', frame=1)
bpy.data.objects['Sphere'].location = [0,0,1]
bpy.data.objects['Sphere'].keyframe_insert(data_path='location', frame=20)
bpy.data.objects['Sphere'].rigid_body.kinematic = False

This is the first frame of the scene:

enter image description here

This is the last frame of the scene, the sphere is located inside the cube:

enter image description here

Thank you very much for helping!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.