Skip to content
Discussion options

You must be logged in to vote

The body id you get from ModelBuilder.add_body() is always the local index of the body within that ModelBuilder.
When you compose builders using a scene ModelBuilder, you can increment the body index by the number of bodies (ModelBuilder.body_count) that come before it in the scene from the other builders:

self.scene = newton.ModelBuilder()
# code to create a FR3 robot arm model builder and then add it to self.scene with add_builder
builder = newton.ModelBuilder()
body = builder.add_body(
    xform=wp.transform(wp.vec3(0.3, 0.0, 0.7), wp.quat_identity()),
)
# Make sure you offset the body index of the number of bodies that are already in the global scene builder
# to get the correct globa…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@StoneT2000
Comment options

Answer selected by StoneT2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants