Hi,
I’m working on a 3rd person template game, wher my character is using a sword. But when he swings the sword and hits something from the ambient, he flies away from the field, some times he starts to rise up eternaly without falling at all. The collision preset of the sword is OverlapAll. At the beginning the sword attacks were working perfect and suddenly this bug appeared without visible reason and stood. Can anybody tell me how to fix it? Thanks!
Are you adding any forces to the character or sword? For example, making a call to AddForce or AddImpulse when the swords or character overlap something?
No I don’t use any forces. Actualy I use the 3rd person template to make FPS game. First I tried to add a sword as an actor but very strange bug appeared when the character equipped the sword, he always walks backwards even when I press W. So I desided to make the sword a part of the character’s mesh. At first everything was OK but then the bug with flying came up. Even when I just look down and I’m equipped with the sword, I start to rise up in the air. I removed the sword from the mesh but the things didn’t changed. Then I changed the animations and the same again. Is it possible the problem to be in the sword mesh? But I used two different sword meshes and they both were making the firs bug I mentioned.
That is very odd behavior. If you have any C++ code, I would start by closing UE4 editor, and rebuilding the project. Then open US4 Editor again and see if the problem persists.
The flying away sounds like something might be in constant collision with the world or your gravity is “disabled”. Does your sword simulate physics? Try setting collision of the sword to No Collision.
I do it with blueprints and I don’t have C++ code. I tried the No Collision preset without result. When I remove the sword, the character keeps doing the same. At first when I finished with the sword animations everything was working perfectly.
Maybe when I was doing the animations for the other weapons after, I boroked something. But how can I do that? And why when I attach the sword as an actor to the characters mesh, his movement crashes and he starts to move only backwards? This is not my first time, when some meshes affect strangely the character’s movement.
If you use a versioning system like Git, for example, try going a few commits back. If you don’t use these tools, and if it doesn’t take too much of your time, make a new 3rd person project and keep adding functionality from this one. If you test often, we should be able to pinpoint what breaks your game.
Until we know exactly where the error is, we can’t fix it.
I tried again to set the sword to No Collision and this time it worked. I set all weapons to no collision and for now the bug is gone and everything is working fine. Only the box collision of the sword is set to Overlap All because otherwise it can’t do damage on the enemies. Looks like the bug was from the collision between the character’s mesh and the weapon’s mesh. Thanks for your help! Best regards.
Great, you got it working!