Skip to content

projectPoint crashes with 'unreachable' in Javascript if all colliders are filtered out #926

@bushmango

Description

@bushmango

If my filter filters out all colliders world.projectPoint crashes

See code below for two crash examples

 // Special case for an emty world to avoid rapier crash
  if (phys.world.colliders.len() === 0) {
    return null // Will crash if there are no colliders
  }
  let proj: PointColliderProjection | null = null
  try {
    proj = phys.world.projectPoint(
      point,
      solid,
      undefined,
      undefined,
      undefined,
      undefined,
      (collider) => {
        return false // <- this will cause a crash as well
      },
    )
  } catch (e) {
    log.error('Error projecting point:', e)
    log.x('point:', point, 'solid:', solid)
    return
  }

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