Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The color of the vehicle has been modified, but the simulator shows the same color as before. Why #8689

Open
qwc0121 opened this issue Feb 18, 2025 · 1 comment

Comments

@qwc0121
Copy link

qwc0121 commented Feb 18, 2025

def main():
client = carla.Client('localhost', 2000)
client.set_timeout(2.0)
world = client.get_world()
spectator = world.get_spectator()

# 获取特定车辆的蓝图(Audi e-tron)
specific_vehicle_blueprint = world.get_blueprint_library().find('vehicle.audi.etron')

# 设置车辆颜色为白色 (R, G, B)
specific_vehicle_blueprint.set_attribute('color', '255, 255, 255')  # 白色
print(f"Set color to: {specific_vehicle_blueprint.get_attribute('color')}")  # >>Set color to: ActorAttribute(id=color,type=Color,value=Color(255,255,255,255))
# 随机选择一个车辆的初始位置
location = random.choice(world.get_map().get_spawn_points()).location

# 使用特定车辆蓝图生成车辆
transform = carla.Transform(location)
vehicle = world.spawn_actor(specific_vehicle_blueprint, transform)
@GoodarzMehr
Copy link

This may be because the material slot is not named "Bodywork_Mat", see #7611

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

No branches or pull requests

2 participants