Skip to content

Commit ca5f18f

Browse files
author
Roberto De Ioris
authored
Create Fracturing_API.md
1 parent 22c1ff1 commit ca5f18f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/Fracturing_API.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# The Fracturing API
2+
3+
Fracturing is one of the best features you get for free in unreal engine.
4+
5+
You can apply damage to destructible objects directly from python (more kind of damages will be added soon)
6+
7+
```py
8+
class DestroyMeComponent:
9+
10+
def begin_play(self):
11+
# get a reference to a destructible component in the actor
12+
self.destructible = self.uobject.get_actor_component_by_type(ue.find_class('DestructibleComponent'))
13+
14+
def tick(self, delta_time):
15+
pass
16+
17+
def explode(self):
18+
# damage amount
19+
amount = 1000
20+
strength = 20000
21+
position = self.uobject.get_owner().get_actor_location()
22+
up = self.uobject.get_owner().get_actor_up()
23+
self.destructible.destructible_apply_damage(amount, strength, position, up)
24+
25+
```
26+
27+
you can now call the 'explode' method via blueprints using the 'Call Python Component Method' node
28+
29+
Another approach (way more easier) would be adding a RadialForceComponent and fire it when you want to destroy something:
30+
31+
```py
32+
# get a reference to the RadialForceComponent
33+
self.radial_force = self.uobject.get_owner().get_actor_component_by_type(ue.find_class('RadialForceComponent'))
34+
35+
# fire it !
36+
self.radial_force.call('FireImpulse')
37+
```
38+

0 commit comments

Comments
 (0)