Skip to content

Does removing a SubShape change the CompoundShape Shapes Array? #174

Answered by jrouwe
DennisSmolek asked this question in Q&A
Discussion options

You must be logged in to vote

When you call RemoveShape(1) the indexes shift, so you'll end up with A:0, C:1, D:2.

Note that the SubShapeID basically encodes a sub shape index, so if you get a SubShapeID and then remove a sub shape, it will no longer point to the same sub shape.

The UserData of a sub shape was meant to keep track of sub shapes while adding/removing and is the only thing that can be used reliably (although from your post I gather you want the indices to shift, so maybe you don't need to track anything extra).

Replies: 1 comment 1 reply

Comment options

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

Answer selected by DennisSmolek
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