|
Previous Step
Next Step调整 Actor 属性
Here we will adjust the 物理模拟 for our Actor as well as the Collision properties inside the Details panel. By adjusting these settings we can define how an Actor responds to other Actors in the game world. We can set our Actor to simulate physics which will allow us to bump into and push the Actor around in the world as well as define how it responds to collision with other Actors.
Steps
With the Shape_Sphere selected, in the Details panel under Collision, check the Simulation Generates Hit Events checkbox.
With this option checked, we can determine if the sphere hits something.
Also in the Collision section, click the Collision Presets drop down and select Physics Actor.
Since we are going to simulate physics, this setting will handle the physics responses for us.
In the Physics section, check the Simulate Physics checkbox.
There are additional options you can set here such as the Damping or Contraints which can affect how physics for the Actor are simulated however for this tutorial all we are going to do is simulate physics so it can be affected by physics during gameplay.
If you play in the editor now, you will see the sphere roll down the stairs and you can walk into it and push it around since it is a Physics Actor. In order to test the Hit Events, we will use a little bit of 蓝图可视化脚本 to kill the player when hit by the sphere.
With the sphere selected in the level, on the Main Toolbar click the Blueprints button then select Open Level Blueprint.
Right-click in the graph window, then under Add Event for Shape Sphere and Collision, select the Add On Actor Hit event.
This will now fire an event when the sphere hits something.
Off the OnActorHit node, drag off the Other Actor pin and search for Cast To ThirdPersonCharacter then select it in the window.
Here we are checking to see if the Other Actor we hit is the ThirdPersonCharacter (or Player used with this template).
Drag off the As Third Person Character pin of the Cast node and search for and add the Destroy Actor node.
If ThirdPersonCharacter was the Other Actor hit, then destroy ThirdPersonCharacter (killing the player character).
Click the Compile button in the upper-left corner of the window to finalize the Blueprint, then close the window.
From the Main Toolbar, click the Play button to play in the editor.
End Result
When you play in the Editor now, you can use WASD to move the character around and the Mouse to manipulate the camera. You should see that the sphere now rolls down the stairs and if you walk into it, it should kill the character making them disappear (press Esc to exit the play session after you have been "killed").
This should give you a brief understanding of how to edit the properites of Actors through the Details panel of the main Level Editor. For more information, please see the related topics below.
Previous Step
Next Step调整 Actor 属性
相关页面
详细信息面板
详细信息面板用户界面
物理模拟
碰撞总览
蓝图可视化脚本
|
|