Skip to content

Multiplayer Series UE4 [3] – Character

Projectile

Allright, since our character and crosshair are not perfectly aligned this give us some problems. Projectile won’t fly straight to where crosshair is pointing and for that we need to cheat.

First priority is to make Projectile go where crosshair is pointing.

Add Projectile Movement Component.

Add Sphere Collision and make it root.

Make Collision Sphere size 5.

Add Sphere (Static mesh) inside Collision Sphere and give it emissive material.

Remove all collisions from it. This is just a visual feature.

Add Audio Component and rename it as GunFireSound.

You can use the gun sound from Firstperson template.

You need to cut the end part off in Audacity.

Add your audio into GunFireSound Component.

In Construction Script Set initial speed variable of Projectile movement, like this.

Here we have bunch of things. First we have OnProjectileStop Event. When actor stops moving it will be deleted. Then we have EventHit which sends Impulse to physic objects. In Event Tick there’s a speed calculator.

Click for bigger

In Event BeginPlay we have visual and audio features so these don’t need to work on server.

Create Dynamic Material Instance for you Emissive Sphere material. So we can zero the Emissive Strength over time.

Timeline settings.

You can also use FInterpTo or FInterptoConstant if you don’t like Timelines.

Projectile Movement settings.

And settings for Sphere Collision.

We want this to go through Pawns so Damage triggers get hit.

Also add float variable Mass.

And give it a value of 0,05

Pages: 1 2 3 4 5 6 7 8 9 10 11
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
Level Paradox
0
Would love your thoughts, please comment.x
()
x