How to Cast to a Skeletal Mesh Component?

I’m currently having a very difficult time getting my character’s weapon to function properly. This is all stemming from the fact that, as my project is a fangame, I am porting over assets from the original game to use as placeholders for the time being and the original game’s assets were made to work in ways that sometimes seem a bit difficult to replicate in Unreal.

Initially, I was able to make things work by having the weapon as a Child Actor component of my character and snapping the static mesh to a socket I created on the character’s skeleton. However, this presents me with the problem of not having animations for the gun itself (the original game separates the guns and arms into separate models with the arms made to follow animations on the gun (at least that’s my understanding anyway)). I’m currently trying to make things work by having the gun as a Skeletal Mesh component, but I’m now having trouble getting a proper cast to the weapon’s BP.

This is where I’m trying to set the gun as my character’s Sidearm variable. Before, I was able to cast to the weapon’s BP using the “FP Weapon Old” and getting “Child Actor” from that as the object. That doesn’t work anymore since it’s no longer a Child Actor component, and while both “Get Parent Actor” and “Get Owner” appear valid as objects at time of compile, attempting to fire the weapon and access anything in the gun’s BP gives me the error of “Accessed None trying to read property Sidearm” in this part.

Help?

279340-getactor.png

Try this and make sure its not Empty/None. Then try other get until one gets what you need and then the cast will work. (If print doesn’t return anything try Get Object Name. Get Display Name will return nothing if its empty)

So you have 2 BPs. WeaponBP and CharacterBP right?

If your question is simply “How to Cast to a Skeletal Mesh Component?”, I would say you want to cast to the actor that contains a specific skeletal mesh component.

Once this cast is successful, you can then get the specific skeletal mesh component of that actor, and then do whatever it is you want to do with it. Hope this helps

Putting this into my character BP, where it seems the trouble is occurring, I get None when I leave the target to self on both Get Parent Actor and Get Owner. When I plug my weapon Skeletal Mesh component into Get Owner, I get my character. Can’t plug the Skeletal Mesh component into Get Parent Actor for whatever reason.

And yes, this is all between the weapon BP and the character BP.

In this case, I’d imagine that the actor containing the Skeletal Mesh component would either be the weapon’s BP (which is what I’m trying to cast to) or my character’s BP, but that’s where I’m trying to cast from.

Well don’t know how else I could help. Could you give a bit more information (Detailed and exact information) or could you make/send project with the 2 BP’s so we can see what’s wrong.

Did You Try This???