Skip to content

请问:如何进行复合查询?比如找到CastShape和CollideShape的并集?或者两次不同的CastShape的并集?(Translation: Question: How do I perform a compound query? For example, how do I find the union of CastShape and CollideShape? Or the union of two different CastShapes?) #2099

Description

@zhaoxue5

如标题,我不知道怎么样写性能才会好,在我的场景,需要复合查询的两次查询的范围差距很大,比如可能一个范围很大,一个范围很小,甚至两次使用的shape都不一定一样

Translation: As the title suggests, I'm unsure how to write a performance-efficient query. In my scenario, the ranges of the two queries in a compound query differ significantly—for example, one range might be very large while the other is very small, and even the shapes used in the two queries might not be the same.

Activity

  1. changed the title [-]请问:如何进行复合查询?比如找到CastShape和CollideShape的并集?或者两次不同的CastShape的并集?[/-] [+]请问:如何进行复合查询?比如找到CastShape和CollideShape的并集?或者两次不同的CastShape的并集?(Translation: Question: How do I perform a compound query? For example, how do I find the union of CastShape and CollideShape? Or the union of two different CastShapes?)[/+] on Aug 22, 2026
  2. jrouwe commented on Aug 22, 2026

    @jrouwe
    Owner

    The automatic translation may be a bit weird so I'm not really sure what you're asking.

    If you're asking how to do multiple queries in a single call: Just call the CollideShape / CastShape function multiple times. I've tried creating an interface that processes multiple queries at the same time in the past, but it wasn't faster.

    If you're asking how to test a collection of shapes against the world / other shapes then combine the query shapes into a StaticCompoundShape or MutableCompoundShape.

    If you're asking how to do a CollideShape and a CastShape at the same time: CastShape is a superset of CollideShape. If you set ShapeCastSettings::mReturnDeepestPoint = true then CastShape will return the same information as CollideShape when a hit with ShapeCastResult::mFraction == 0 is returned.

  3. Repository owner locked and limited conversation to collaborators on Aug 22, 2026
  4. converted this issue into a discussion #2104 on Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions