Skip to content

parentName #366

@EveCharbie

Description

@EveCharbie

I would like to have the name of the segment on which a rigid contact is placed.

We have hacked it by doing :

    def rigid_contact_segment(self, contact_index) -> str:
        """
        Returns the name of the segment on which this specific rigid contact is.
        """
        for segment in self.model.segments():
            if segment.id() == self.model.rigidContact(contact_index).parentId():
                return segment.name().to_string()
        raise RuntimeError(f"The segment for the rigid contact index {contact_index} was not found.")

However, when there is a contact on the root segment, the ids do not match leading to fall on the RuntimeError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions