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

TOPIC:

Editing Carbon Rigid Bodies 2 weeks 2 days ago #660

  • admin
  • admin's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • Posts: 174
  • Thank you received: 21
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 example_scripted_chain.py 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 - 

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

Mel:
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
carbonPublicAPI_ResetSimulation("carbonSimulationShape1");

// 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.047 seconds