# How do I position two solids so that they touch without overlap in Simscape Multibody?

4 views (last 30 days)
MathWorks Support Team on 7 Feb 2023
I would like to position two solids in Simscape Multibody such that their faces touch without any overlap or gap in between. How would I accomplish this?

MathWorks Support Team on 7 Feb 2023
As an example, below I have provided steps for placing a brick solid on top of another brick solid.  This procedure can be applied to other solid blocks and for other spatial configurations of solids.
1. Add two 'Brick Solid' blocks and a 'World Frame' block to your model.
2. Name the 'Brick Solid' blocks 'BottomBlock' and 'TopBlock'.
3. Connect the 'R' port of 'BottomBlock' to the 'World Frame' block.
4. Inside the dialog window for 'BottomBlock', create a new frame in the 'Frames' tab and rename it to 'Frame1'.
5. Click the 'pencil' icon next to the newly created frame 'Frame1' to edit it.
6. Set 'Frame Origin' to 'Based on Geometric Feature', click on the top face of the solid inside the 3d preview, press 'Use Selected Feature', and save changes.
7. Open the dialog window of 'TopBlock' and deselect 'Show R Port' under 'Frames'.
8. Create a new frame for 'TopBlock' and rename it to 'Frame2'.
9. Repeat Step 6, but instead of using the top face as the geometric feature, rotate the camera in the 3d preview and select the bottom face.
10. Connect the 'Frame1' port on 'BottomBlock' to the 'Frame2' port on 'TopBlock'.
In general, it is best to create custom frames that are based on geometric features and to use those frames to describe the relationship between two solids that touch. The 'R' port, defined for all solid blocks, represents the center of mass of that solid. It is common to connect objects to the 'World Frame' via their 'R' port because the 'World Frame' is not a solid.  Connections between solids should not be made using the 'R' port as it is not physically possible for one solid to exist inside another.

### Categories

Find more on Bodies in Help Center and File Exchange

R2021b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by