• News

• Industries

• Learning & Support

• Community

• Marketplace

# Real life projectile simulation is it possible?

Hi, is real life projectile simulation possible in unreal engine? I have been trying to figure this out for months and still stuck. For my game I want to use projectiles not the hit scan stuff.
I have some questions like;
• What is the max usable velocity in the ProjectileMovement Component?
• Is the velocity in the ProjectileMovement Component in centimeters? if not what units is it using?
• What did these games use? Projectile or hit scans? Dayz Mod, PubG, H1Z1, Fortnight? A long time ago while playing DayZ mod the server was restarting and froze the screen and a sniper bullet was right next to my head so I’m assuming DayZ mod used projectiles?

I added a RPG-7 in my game and created a projectile for it using a blueprint and ProjectileMovement Component with a collision sphere. So far so good, almost, but the projectile won’t register collision unless the object it hits is about 50 feet away or so. I know there are lots a variables with collision and setup but I will just describe the basic adjustments I changed.

RPG-7 Projectile
984.0 feet per second (Wikipedia)

Unreal Engine Units are in Centimeters so I take 984.0 ft x 30.48 cm = 29992.3 cm. I use 29992.3 as my velocity, right? (1 ft = 30.48 cm in case anyone needed to know where I got 30.48 cm from) Everything looks great but the collision is really bad. I tried everything from around 30+ posts and still no luck. I’m thinking my projectile is just going to fast and Unreal Engine can’t handle these real life projectile speeds? An expert please let me know.

Projectile Static Mesh:
• Removed collision from actual static mesh.
• Collision Presets = No Collision
• Use CCD = Off
• Physics = Off
• Enable Gravity = Off

Collision Sphere:
• Collision Presets = BlockAll
• Use CCD = On
• Physics = Off
• Enable Gravity = Off for now
• Simulation generates hit events = On
• Generate Overlap events = On

I’ve tried it with the collision sphere as the root to and no luck.

Any help appreciated, Thanks

What?

Again, what?

Try force substepping in the projectile movement. Or turning on substepping in the project settings.

I did try substepping, both options. What a else do you think I should try? There was a time option there to, should I adjust it?

“Everything looks great but the collision is really bad” Yes exactly what I said lol. The projectile fly’s through the air as it should, the collision just isn’t good at closer ranges. I have read in the forums it’s because of the fast speed it’s going. Well even at further distances the rocket can be 3 feet away from something and still hit it… even though the collision sphere is the size of a base ball. This is driving me nuts lol Thanks for your input.

Well you still haven’t explained your collision issue.
Does your rocket successfully hit something closer than 50 feet, or only hits at 50feet and greater?

Out of curiosity I loaded up a blank project with the First Person template. The one that comes in the editor.
All I did was change the projectile speeds to 30000 and it hits everything just perfect. In fact I even Bumped it up to 300,000 still worked.
Then I bumped it up to 3,000,000. I couldn’t see the projectile at all but it was still hitting/moving the physics targets.

Nope, but if I set my velocity to 5,000 I can get it closer to about 10 feet away that it can hit things.

You gave me a good idea of testing it out in the First Person Template. What I noticed is the projectile in the FPS has collision on the actual static projectile mesh, mine doesn’t and lots of people say remove it… I set the velocity in the FPS to 30,000 and I thought everything was fine but if you get almost touching the big cube and take a step back the projectile was going through it… sometimes it was working but I would say that 75% of the time in my little test the projectile wasn’t hitting the cube for some reason. This is strange because sometimes it works just not consistent within a few feet away from target/cube. To test what I’m saying run right up to a cube and shoot, then tap the (s) key once fast then shoot, repeat (the character should be backing up about a foot each time) and usually by the 6th or 7th time the cube will get hit. I need the cube to get hit point blank pretty much because if a player is right up against me I need to be able to shoot him. I am happy though because it’s working way better than my setup and I’m getting closer to getting this right.

I also noticed in my project I set most of my actors/props that I shoot to a mass scale of 100 and the default is 1.I did this because they were bouncing around to much otherwise, you could run into them and they would just fly away with the default mass scale. After changing the mass scale under static mesh/physics of the items I’m shooting it was working close to the FPS project.

I will have to get the FPS working consistent at very close range then I will have to fix my actor/props physics in my project so they are setup right. Thanks again for taking the time to help me. If you can think of anything else to try just let me know.

In the FPS template the projectile spawn location is setup to be moved in front of the gun, controlled by the character blueprint. So it could cause issues at point blank range. You’ll have to change the projectile spawn location and or change the nodes a little. Or just change Spawn properties to Always spawn/ignore Collision in the same character blueprint.

To visually check the projectile spawn location:
I put an arrow in the character components, unchecked the arrow hidden in game, did a setworldtransform to the arrow, using the same transform used by the projectile.

Using the arrow and setworldtransform I was able achieve point blank range even having the barrel touching the cubes. This is awesome! So back over to my main project, I tried to set it up the same way but it won’t work unless I make the collision sphere my root, this is really lame because I have a master blueprint class with child classes and when it’s a child class you can’t change the root to a collision sphere. My main parent class is the parent to all my classes, then child classes branch off from there into my item categories e.g. weapons, ammo, projectiles, food, etc. This really throws a wrench in my current setup. I could just create a new parent class just for projectiles and make the collision sphere the root but then in the child blueprints you are not able to resize the collision sphere because it’s the root. I was thinking bullets, rockets etc. maybe, just make the collision sphere in the parent root the size of a normal bullet no matter what kind of projectile it is… Have you been able to fire a projectile without the collision sphere being the main root? Thanks, hope I didn’t write to much and leave a bunch of details out.

Not sure why you can’t resize, you should be able to use the scale settings in the details panel for almost any component, in both the main and child BP.

Regardless, I tried a few things to get sphere as root working. I made it the root then changed the sphere collision preset to projectile. That worked fine.

The collision component is no longer needed if you do that. I deleted it and the sphere by itself still works fine. But I had to change the transform settings to a scale of 0.1 in the character blueprint because otherwise it reverts the sphere scale back to a huge sphere. Which shows that you can also resize your objects outside of their own blueprints and on the fly.

The only way that I found I can change it is by typing in the size manually, but hey it works. Thanks you really got me past putting my head through my keyboard.