駕駛 Chaos 車輛
匯入模型和貼圖: 將模型和貼圖匯入到引擎的Browser
這台車已經Rig了
FBX import Options:
Skeletal Mesh: turn on
Combine Meshes: If you have many separate mesh, you could turn on
Plugins:
ChaosVehiclesPlugin
WheeledVehiclePawn
Create BP:
Right click mouse > Blueprint Class
All Classes:
search: vehicle
Select “ WheeledVehiclePawn ”
Mesh > Skeletal Mesh Asset > car
攝影機
Left side > +Add > SpringArm and Camera
Setup camera target Arm Length: 600
攝影機設定
Turn off:
Inherit Pitch
Inherit Yaw
Inherit Roll
攝影機碰撞:
Probe Size: 0
Do collsion test: Turn Off
輪胎設定
選上 Vehicle Movement Component
這台車有四顆輪子,所以按四次 +
Wheel Setup > Wheel Setups > +
Go to Skeleton and 拷貝骨頭名字
選骨頭 > 右鍵 > Copy selected Bone Names
Paste to Wheel setups index bone name
引擎扭力設定
Vehicle Movement component > Mechanical Setup
2種方式可以創建 扭力曲線
方法1: 點兩下扭力曲線視窗
The graph's X 軸代表引擎 RPM (每分鐘轉數)
The graph's Y軸代表引擎扭力輸出 NM (Newton Meters)
Total Tougue : 300
Add curve points in 300
Shift + 滑鼠左鍵 : Add points
曲線如圖
方法2:
滑鼠右鍵 > Miscellaneous > Curve
Pick Curve Class: CurveFloat
Add Keys
Go to BP_Car
Vehicle Movement component > Mechanical Setup
External Curve > 選上剛剛所創建的curve
Chaos Vehicle wheel Blueprint
在大多數情況下,每輛車至少需要兩種類型的車輪。.
一個受轉向/引擎/手煞車影響的車輪,一個不受轉向/引擎/手煞車影響的車輪
這可能是前輪或後輪尺寸不同的情況
Create wheel BP:
Blueprint Class > ChaosVehicleWheel
Create front and rear wheel BP
Double click BP_Front_Wheel
Setup
Wheel > Axle Type : Front
Affected by Handbrake: Turn Off
Affected by Engine: Turn on
Wheels setup
Max steer Angle:45
Affected by steering: Turn on
Double click BP_Rear_Wheel
Setup
Wheel > Axle Type : Front
Affected by Handbrake: Turn on
Affected by Engine: Turn on
Go back to BP_Car
更新wheel setups class
Turn on Simulate Physics
Game Mode
Default Pawn Class: BP_Car
World Settings
Window > World Settings
Game mode
GameMode Override: GM_Car
執行結果
車子物理
選擇物理並刪除
因為預設的形狀,比較不會跟車子輪胎,車體等一樣
選擇全部輪胎骨頭 > Primitive shape: Sphere >Add bodies
選擇Root 骨頭> Primitive shape: Single convex Hull >Add bodies
控制攝影機選轉
Open BP_Car
使用滑鼠來旋轉攝影機
Mouse X Axis Value ---> Delta Rotation Z
Mouse Y Axis Value ---> Delta Rotate Y
執行結果:
發現車子不是在地板上,是浮空的
改變車輪範圍
Go to BP_FrontWheel and BP_RearWheel change “ wheel radius ”
Wheel Radius: 20
Result:
Vehicle Movement
Input Action
Project settings
Go to Engine - Input
Action Mappings: HandBrake --> Spacebar
Axis Mappings:
Thottle --> W
Brake --> S
Steering --> A , D
Go to BP_Car
Each InputAsix to connect
Vehicle Movement
Animaton
保留我們想要的車輛行為
Select car skeleton > right click mouse > Create > Anim Blueprint
Opne AnimBP > Class Settings > class options > Parent Class : Vehicle Animation Instance
Mesh Space Ref Pose: 這用於返回動畫藍圖中骨架網格物件的網格空間參考姿勢
Wheel Controller : 為了減輕創建這些類型動畫的大量工作,您可以使用滾輪控制器節點來驅動動畫。
GO to BP_Car
Select Mesh > Animation > Anim Class : AB_Car
Play game
Result
Youtube Tutorial:
教學專案和文件下載 / Full Project and Document Download:
Sketchfab - Car Scene:
How to Set up Vehicles Unreal Engine 5.0
贊助 / Support Me
BuyMeAcoffee: https://www.buymeacoffee.com/lutopialab
Patreon: https://www.patreon.com/LutopiaLab/
#ChaosPhysics #car #UnrealEngine5 #教學 #虛幻引擎 #車子#Vehicle #Drive
Comments