Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1


Editing Carbon Rigid Bodies 2 years 4 months ago #660

  • admin
  • admin's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • Posts: 207
  • Thank you received: 28
The video below explains how to move a Carbon Rigid Body from one mesh to another without recreating the Carbon Rigid Body from scratch.
Typically you would do this with script as part of a batch process.

In the Carbon documentation we have reference pages for the api, and we have examples, like example_scripted_chain.mel and which use the scripts required for this process. The specific script lines required to move the Carbon Rigid and Carbon Shape to a new mesh are - 

import carbonPublicAPI
carbonPublicAPI.changeMesh('carbonRigidShape1', 'mesh', 'pSphereShape2')
carbonPublicAPI.changeMesh('carbonShapeShape1', 'mesh', 'pSphereShape2')

carbonPublicAPI_ChangeMesh("carbonRigidShape1", "mesh", "pSphereShape2");
carbonPublicAPI_ChangeMesh("carbonShapeShape1", "mesh", "pSphereShape2");

You need to reset the sim after the change so the whole script might look like this -
// Load Carbon plugin if not loaded yet
int $isLoaded = `pluginInfo -q -loaded Carbon`;
if($isLoaded == 0)
    loadPlugin Carbon;
    // Source is only needed because loading of the plugin happens
    // in a different thread while this script continues to be evaluated.
    source "carbonPublicAPI.mel";
// Set rigid transform based on new mesh
carbonPublicAPI_ChangeMesh("pSphereRigid11Shape", "mesh", "pSphereShape2");

// Reset Carbon simulation

// Play timeline
play -forward true;


Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.065 seconds