CARLA
 
载入中...
搜索中...
未找到
Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/VehicleControl.h
浏览该文件的文档.
1// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7// 预编译头文件保护指令,确保该头文件在同一个编译单元中只会被包含一次,避免出现重复定义等问题
8#pragma once
9
10// 包含用于UE4反射系统生成相关代码的头文件,使得下面定义的 FVehicleControl 结构体能够被UE4的反射机制正确处理,例如在蓝图中使用等
11#include "VehicleControl.generated.h"
12
13// 使用USTRUCT宏定义一个结构体,标记为BlueprintType 意味着这个结构体可以在UE4的蓝图可视化编程环境中使用,方便进行数据传递和操作等
14USTRUCT(BlueprintType)
15struct CARLA_API FVehicleControl
16{
17 // 由UE4的反射系统生成的代码相关宏,用于自动生成结构体的一些必要的底层代码,比如序列化等相关代码,确保结构体能正确参与UE4中的各种操作
18 GENERATED_BODY()
19
20 // UPROPERTY宏用于将结构体中的成员变量暴露给UE4的属性系统,使得这些变量可以在UE4编辑器中显示和编辑,同时可以设置相应属性。
21 // 此成员变量属于"Vehicle Control"分类,在编辑器中可以在任何地方进行编辑(EditAnywhere),并且在蓝图中可读可写(BlueprintReadWrite),
22 // 用于表示车辆的油门开度,取值范围通常是0.0到1.0(这里初始值设为0.0f,表示油门未踩下的状态)
23 UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
24 float Throttle = 0.0f;
25
26 // 同样使用UPROPERTY宏暴露的成员变量,属于"Vehicle Control"分类,可在编辑器任意处编辑、蓝图中可读可写,
27 // 用于表示车辆的转向角度,取值范围通常根据具体游戏设定,一般是一个合理的角度范围(这里初始值为0.0f,表示车辆处于直线行驶状态)
28 UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
29 float Steer = 0.0f;
30
31 // 还是通过UPROPERTY宏暴露的成员变量,属于"Vehicle Control"分类,可在编辑器任意处编辑、蓝图中可读可写,
32 // 用于表示车辆的刹车力度,取值范围通常是0.0到1.0(这里初始值设为0.0f,表示未踩刹车的状态)
33 UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
34 float Brake = 0.0f;
35
36 // 借助UPROPERTY宏定义的成员变量,属于"Vehicle Control"分类,可在编辑器任意处编辑、蓝图中可读可写,
37 // 用于表示车辆的手刹是否拉起,初始值为false,表示手刹未拉起的状态
38 UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
39 bool bHandBrake = false;
40
41 // 通过UPROPERTY宏定义的成员变量,属于"Vehicle Control"分类,可在编辑器任意处编辑、蓝图中可读可写,
42 // 用于表示车辆是否处于倒车状态,初始值为false,表示车辆正处于前进状态
43 UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
44 bool bReverse = false;
45
46 // 同样使用UPROPERTY宏定义的成员变量,属于"Vehicle Control"分类,可在编辑器任意处编辑、蓝图中可读可写,
47 // 用于表示车辆是否处于手动换挡模式,初始值为false,表示车辆处于自动换挡模式
48 UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
49 bool bManualGearShift = false;
50
51 // 此成员变量也通过UPROPERTY宏暴露,属于"Vehicle Control"分类,可在编辑器任意处编辑、蓝图中可读可写,
52 // 并且设置了元数据(meta)中的编辑条件(EditCondition)为 bManualGearShift,意味着只有当 bManualGearShift 为true(即车辆处于手动换挡模式)时,
53 // 这个变量才可以在编辑器中进行编辑,用于表示车辆当前所处的挡位,初始值为0(具体挡位含义根据游戏内设定,一般0可能表示空挡等情况)
54 UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite, meta = (EditCondition = bManualGearShift))
55 int32 Gear = 0;
56};
FVehicleControl Control
Definition ActorData.h:119