Hello, in the attached picture, I have a function that attaches the pickaxe to the player once called. However if I have physics enabled the mesh doesnt move the desired location however I noticed that the pickaxe actor does attach to the player in the World Outliner so it is happening in code but not visually.
Have you tried socketing the pickaxe. If it’s socketed it should move relative to the socket. The origin point of the pickaxe will in a sense snap to the set socket. You can then use a local offset to adjust it positionally. But afaik/recall if an actor has physics enabled it’ll move on its own.
Bottom line I wouldn’t use physics on the pickaxe. I’d create a BP class for the pick axe, add collision components and use them for hit related events.
A curiosity with your BP is that you turn on physics, but disable collision. Why?
I want to have physics enabled to allow it to fall out of the players hands. In my game there will be no inventory so the player has to manually pick items up since there’s no “backpack” to place the item.
Physics is kept on until I pick up the object. The reason I need to disable collision is because I have a linetrace that allows me to pick up the pickaxe which I then disable its collision because for some reason when I am “holding” the pickaxe it makes the player move very weirdly where you could go like 100mph backwards and stuff, but once I disabled collision it was fine.
I cant have a socket as I have no static mesh for the player since making a mesh and skeletal mesh would take too much time. So the Point For Tool coming out of the PlayerCharacter cast is just a scene component that has a location I can use.
ok gotcha.
thoughts …
Spawn axe in world: no physics, simple collision for pickup trace.
On pickup: disable collision.
On drop: enable collision (physics, query), enable physics. On rest (no longer moving), disable physics.
Say the weapon is on the ground. With physics on there’s a very high chance of player physics interaction(s). Player/item getting smacked causing absurd movement (physics impulse/force). This is the reason why your character moves (100mph backward). Physics interaction between the two (player/axe).
There’s got to be an easier way because setting the physics every time the velocity is 0 and enabling and disabling I feel would cause problems. I wish they added a feature for this to just work because I can see the pickaxe attaching the player in the world outliner in game but the mesh doesn’t follow.
I just went through this with my system. In the end I disable all physics on all my item BP’s and when I drop them I enable physics on them, works fine. Attaching the items/weapons works great too, just set collision to ignore pawn. Mines all done but now I ran into another problem, of course. When my player dies he ragdolls and the item/weapon becomes active somehow and flops around everyplace and won’t stop haha. Seems when I enable physics on the characters mesh to ragdoll, it messes with the attached actor physics/collision again… Hope you figure it out, best of luck. If you have any questions ask away
Yea, with my game I dont want physics to be turned off while on the ground but glad you’ve got stuff going.
Is your game going to be multiplayer? with a dedicated server? if so u will run into actor position sync issues unless you use smooth sync plugin or do your own. With physics enabled it’s a nightmare.
Na. I dont plan on making it multiplayer. I just want this to work. I dont know if you have heard of Hydroneer before. That games pickup system is how I would like mine to be as well.
Hey, I am facing the same issue. Did u solve the problem?
+1 Same issue here.
Blockquote
thoughts …
Spawn axe in world: no physics, simple collision for pickup trace.
On pickup: disable collision.
On drop: enable collision (physics, query), enable physics. On rest (no longer moving), disable physics.
Once the physics of the skeletal mesh has been activated, it won’t attach properly. Your approach will work for first pickup but once physics have been enabled and disabled again, it won’t work anymore.
I disable physics right before the attachment, but it doesn’t work.
Workaround #1:
Destroy the physics actor, spawn a new one and attach that one. Will work but then you have to store the info of said actor somewhere (like ammo if you drop a gun)
Could be solved with a proper save system, but doesn’t feel very efficient
Workaround #2:
Make the skeletal mesh the root. Then it will work as intended, but you have to setup a new socket for every different tool/gun etc. as you cannot manually adjust it compared to having a scene root.
Effort can be reduced by using IK for the other hand (in case of guns), but still requires multiple sockets at the same bone
If anyone comes up with a solution, please share it. It will be much appreciated!!
SOLVED!
On Pickup:
In the pickable item BP:
I. Disable collision of the sphere
II. Disable Physics Simulation of the skeletal mesh
III. Detach mesh from root (keep relative)
IV. Re-attach mesh to the root (snap to target)
In the Character BP:
V. Cast to Character BP and attach to hand (snap to target)
Works in 4.27 (also in Multiplayer via Multicast), gun re-pickable after drop, physics work fine
I also managed to solve this with a similar approach as Heigl_KFP. Here is the link to the post, with pictures of the blueprint:
III. Detach mesh from root (keep relative)
I just made an account to tell you that you’re amazing for this one, Thank you.