Skip to content

How to know which CharacterVirtual did collide? #1521

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

You must be logged in to vote

If you're not colliding against bodies then the standard collectors cannot give you the context you need, so you'll have to implement your own collector. You can use CollisionCollector::SetUserData with the character as parameter before calling CollideShape so that in the CollisionCollector::AddHit function you know and can store which character the hit is for.

This pattern is used here:

ioCollector.SetUserData(reinterpret_cast<uint64>(c));

virtual void SetUserData(uint64 inUserData) override { mOtherCharacter = r…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hugarty
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