Projectile Bug

Build Type: Binary build from launcher

Build Version: 4.11.1-2934540+++UE4+Release-4.11

Detailed Description: I created another post regarding this issue nearly 1 week ago and have received zero support. That question can be found here: Pivot Point Separation - World Creation - Unreal Engine Forums

To briefly run it down - for some unknown reason, when I shoot a projectile, I can tell that the pivot point of the projectile is separating from the projectile mesh. When I use “Velocity” (any form of) the pivot point shoots as it should but the mesh falls straight to the ground. If I use “Impulse” then the mesh shoots as it should but the pivot point falls straight to the ground. I am using a “custom” mesh, although it is a simple cylinder; I have tested this issue using the default game engine “Sphere” mesh and receive the same results. I’ve never experienced this issue before in previous versions. To ensure the issue was not something in my (very simplistic) project, I created an entirely new, fresh 4.11 project and did very basic tasks to reproduce the issue and it occurs again. See the attached image for the example of the pivot separating from the mesh.

Screenshot:

Repro Steps:

  1. Create blank BP project - Mobile, 2D/3D scalable, No Starter Content;
  2. Create Basic custom ‘Game Mode’
  3. Create Basic custom ‘Player Controller’
  4. Create Basic custom ‘Pawn’
  5. Set custom controller and pawn as default classes in the Game Mode and set custom Game Mode to the world
  6. Create a simple Widget, add a button to the screen. The button will trigger a function inside the player controller called ‘Fire Weapon’
  7. In the custom Pawn, I put my “custom” gun barrel (a simple elongated cylinder) as the static mesh, child to a scene component, then add a camera to look over the gun barrel
  8. On my “custom” gun barrel mesh, I add a socket called “Muzzle”
  9. On the player controller in Begin Play, I create the custom Widget, add it to viewport then create a function called ‘FireWeapon’ which is to be triggered when the Widget button is pressed
  10. Create a ‘Projectile’ blueprint. Add Scene component, make it root. Add Static Mesh component and set my “custom” mesh as the projectile. Ensure ‘Simulate Physics’ is checked as well as ‘Simulation Generates Hit Events’ on the Static Mesh (projectile.) Add a ‘Projectile Movement’ component. On Projectile Movement, set ‘Initial Speed’ to 1000 and set ‘Velocity’ to X:1000, Y:0, Z:0
  11. In the player controller → FireWeapon function, I ‘Spawn Actor From Class’ and set it to spawn my custom projectile. I set the transform to that of the socket of the gun used in the player Pawn called ‘Muzzle’ (see step 8)
  12. Go to map view. Select ‘Play’ to start PIE
  13. To be able to see the separation of pivot/mesh, pause the game then ‘Eject’ from the controller. While still paused, click the Widget button to spawn a projectile. In the World Outliner, select the newly spawned projectile to highlight it. Unpause the game and you will see the pivot point (noticeable by the Gizmo) shoot outwards and the mesh fall straight to the ground
  14. To see this in reverse, go to projectile BP, select the Projectile Movement component, set ‘Initial Speed’ to 0 and ‘Velocity’ on the X to 1.0 (default). Go into the Event Graph and on ‘Begin Play’ drag a new node ‘Add Impulse (Projectile)’ and set the ‘X’ to around 200. Follow the steps 12-13 to see the reverse happen

As mentioned, I’ve tried this using the default ‘Sphere’ mesh provided by the engine and has same effect. I also ensured that this wasn’t something that occurred because of the ‘Pause’ and ‘Eject’ method I did in steps 12-13. It’s harder to do but you can click the button to spawn the projectile and quickly pause the game, select the projectile from the World Outliner (you may still need to eject to do this) and you can once again see the separation of pivot & mesh

Attachments: I have attached a copy of my very simple test project which includes my “custom” meshes here

[Simple Projectile Project][2]

Any help you can provide me on this would be super appreciated! Let me know if there’s any other information you need from me.

Thanks,
Jesse


UPDATE: So I decided to try and reproduce this error in 4.10.2 (4.10.2-2818068+++depot+UE4-Releases+4.10), first using Velocity, and it worked! There was one small piece I forgot to include in the above steps - Simulate Physics. I went back to the 4.11 project, turned off Simulate Physics on the Mesh of my projectile, removed ‘Impulse’ and set Velocity & Initial Speed to 1000 each. The projectile fires as it should!

Trying this with Impulse rather than Velocity (you must have Simulate Physics enabled to use impulse) and regardless of version, the same error as above occurs - separation of pivot/mesh. I can live with using velocity, and it’s probably better than Impulse as the speed is more easily calculable, but this seems very odd that this occurs when using Impulse and Simulate Physics enabled. I’m unsure if this is desired functionality (don’t see why it would be) or if it’s a bug that’s gone unnoticed. I’m equally stumped as to why this occurs using Velocity with Simulate Physics enabled?

Hello,

Try turning Simulate Physics off and seeing if the pivot stays with the actor. What you could be seeing is that the pivot of the blueprint continues to go on, but the pivot of the mesh itself is still with the mesh. You are probably seeing the pivot of the Root Component of that projectile blueprint, not the pivot of the projectile mesh itself. This is expected behavior.

Have a great day

Thanks Sean. As I noted in the “UPDATE” section of my question yesterday, I did discover that turning off ‘Simulate Physics’ did solve the issue of the mesh/pivot separation. However, when I went to apply this to my real project (as opposed to the test one I linked here), I noticed that the projectile was not receiving Hit Events, even with ‘Simulation Generates Hit Events’ ticked, while Simulate Physics was turned off. This is rather important for a bullet/projectile.

Having thought deeper into your answer, I decided to try removing the ‘Scene’ component of the projectile blueprint making the Projectile Mesh the default scene root which was accompanied only by the projectile movement component. Now I am getting the desired/expected results I was looking for! The projectile mesh now moves with Simulate Physics enabled and have no Pivot/Root separation while also receiving the Hit Events!

Having gone through this, and discovering what the issue was accompanied by your answer of “This is expected behavior,” do you think you could elaborate as to why this is expected? It seems odd to me that the mesh (or any other child component) would separate from it’s parent scene component with Physics Enabled and using Velocity.

Thanks again!
Jesse

This is most likely because the mesh is set to simulate physics, but the root component is not. The results that I saw in your project made sense to us when we looked over your setup. What I would normally recommend is making the “main” component, so to speak, (meaning the projectile mesh in your case). Typically, this will lead to the best results.

I’m glad to hear that you were able to resolve your issue. Good luck with your project!

Ok that makes sense since the parent, in this case the Scene component, does not inherit from children and therefore doesn’t know of the Simulate Physics. I’m just so use to needing a Scene component as root so I can transform the children procedurally. Thanks for the help and explanation!

Jesse