Skip to content

Fix for below ground trigger boxes.#9381

Merged
LuisPovedaCano merged 2 commits intocarla-simulator:ue4-devfrom
GoodarzMehr:goodarzm/fix-trigger-bbox
Oct 24, 2025
Merged

Fix for below ground trigger boxes.#9381
LuisPovedaCano merged 2 commits intocarla-simulator:ue4-devfrom
GoodarzMehr:goodarzm/fix-trigger-bbox

Conversation

@GoodarzMehr
Copy link
Copy Markdown

@GoodarzMehr GoodarzMehr commented Oct 22, 2025

Fixes #9362 , does not fix #9361 as that seems to be an ObjectRegister issue. Basically, instead of moving actors to ground height, this only moves the static mesh component, preserving the location of the trigger boxes. I have also increased the Start search height to 200.0f since traffic lights in Town12 are spawn ~70 cm below the ground level and need to be brought up.

I've been using the following script to test this:

import time
import carla

import numpy as np 

client = carla.Client('localhost', 2000)
client.set_timeout(80.0)
client.load_world('Town12')

time.sleep(3.0)

world = client.get_world()
sp = world.get_spectator()
sp.set_location(carla.Location(x=-1130, y=3930.0, z=360.0))

time.sleep(3.0)

actors = world.get_actors()
for x in actors:
    if 8 in x.semantic_tags and not x.is_dormant:
        bbox = x.bounding_box.get_world_vertices(x.get_transform())
        for y in bbox:
            world.debug.draw_point(y, size=0.5, color=carla.Color(255, 0, 0), life_time=100.0)

time.sleep(1.0)

signs = world.get_environment_objects(carla.CityObjectLabel.TrafficSigns)
for obj in signs:
    bbox = obj.bounding_box.get_local_vertices()
    for y in bbox:
        world.debug.draw_point(y, size=0.5, color=carla.Color(255, 255, 255), life_time=100.0)

time.sleep(20.0)

sp.set_location(carla.Location(x=-800, y=3930.0, z=370.0))

time.sleep(3.0)

for x in actors:
    if 7 in x.semantic_tags and not x.is_dormant:
        bbox = x.bounding_box.get_world_vertices(x.get_transform())
        for y in bbox:
            world.debug.draw_point(y, size=0.5, color=carla.Color(0, 255, 0), life_time=100.0)

time.sleep(20.0)

for x in actors:
    if 7 in x.semantic_tags and not x.is_dormant:
        bboxes = x.get_light_boxes()
        for box in bboxes:
            bbox = box.get_local_vertices()
            x_diff = round((x.get_location().x - box.location.x)/1000.0) * 1000.0
            y_diff = round((x.get_location().y - box.location.y)/1000.0) * 1000.0
            for y in bbox:
                world.debug.draw_point(y + carla.Vector3D(x=x_diff, y=y_diff, z=0.0), size=0.5, color=carla.Color(0, 0, 255), life_time=100.0)
Screenshot from 2025-10-22 17-16-39 Screenshot from 2025-10-22 17-17-30 Screenshot from 2025-10-22 17-17-47

Where has this been tested?

  • Platform(s): Ubuntu 22.04
  • Python version(s): 3.10.12
  • Unreal Engine version(s): 4.26

Possible Drawbacks

N/A at the moment.


This change is Reviewable

@GoodarzMehr GoodarzMehr requested a review from a team as a code owner October 22, 2025 21:26
@update-docs
Copy link
Copy Markdown

update-docs bot commented Oct 22, 2025

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update our CHANGELOG.md based on your changes.

@LuisPovedaCano
Copy link
Copy Markdown
Contributor

Thanks for the PR. We currently have a draft PR that also solves this issue. We are trying to test it extensively to make sure it doesn't fail again.

@GoodarzMehr
Copy link
Copy Markdown
Author

GoodarzMehr commented Oct 23, 2025

Thanks for letting me know. I switched to that branch and, after cleaning and rebuilding the make files, tried to test it using the script above. The issue seemed to persist in Town12 (in particular stop sign bounding boxes were below ground), so is there anything I'm missing (perhaps some change in the content files, or something wrong with the test script)?

@LuisPovedaCano
Copy link
Copy Markdown
Contributor

Thanks for the report.
I've been testing with the PythonAPI and checking the bounding boxes visually in the editor toggling the collision visualization.
I will check with your script

@LuisPovedaCano
Copy link
Copy Markdown
Contributor

I've been testing your branch in Town12, Town13 and Town15 and it works.

@LuisPovedaCano LuisPovedaCano merged commit c1ba734 into carla-simulator:ue4-dev Oct 24, 2025
2 checks passed
@GoodarzMehr
Copy link
Copy Markdown
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants