Ok so Im having trouble with attaching weapons. Sure I can set up a socket to attach one weapon to but what happens when I want to attach a different weapon that has a different point of origin and rotation. Do I have to model the weapon with the required location and rotation? That seems very tedious and not very precise. Does anyone have any way for efficient weapon attaching?
Lemmi try explain a little better, say I have a rifle, and a socket on my characters palm that has the required location and rotation to attach that rifle to the palm. But now the character wants to pick up a spear and the palm socket is not rotated properly for the spear. And then all the other weapons that are in the game…
How the heck does any one get past this problem. And how can I attach different weapons in an accurate way (so that reload animations work properly).
change the rotation of your spear when imported. if you already have it imported open the mesh and in the details panel you will find a section to change rotation, location and scale on re-import. just change those.
Is that really the way its done? That seems really tedious and inaccurate. And also wouldnt it mean that when placing the weapon into the world or spawning the weapon in it would have that angle as well. Hmh…
Yes, although if you dont want to change your source asset another(slightly hacky) option would be to Add an offset and rotation to your mesh when interacting/attaching it.
Another good option would be to create custom socket inside of your Static Mesh (socket manager tab)
Would rotating the root bone in an animation work well? Is this REALLY the way its done? You guys should totally make this way better. There might be something I dont get, how do the pros do it where they can have really complex animations. And also how would creating a socket in the selected mesh help?
IDEA:
What if instead of the preview mesh moving the socket, it moves the selected mesh and when finished it saves the location and rotation of that specific preview mesh in the preview meshs class and then when attaching the mesh to that socket it would get the information from the mesh and applying it to the attaching process so that there could be custom attachments for different meshs (and skeletal meshs).
the proper way to fix things would be to go into a modeling program and fix the rotation and origin point of your models. then you would also make different animations for different item types (pistol, rifle, sword).
if you want to see some examples check out the infinity blade weapons and the anim starter pack.
the solutions your proposing are a bit complex and would be a nightmare to implement. its better to have a standard when making your item assets and stick to it.
you should never need to move the socket. the origin for a gun would be where the grip is and the origin for the spear would be where the hand holds it.
and yes you would play animations for the character mesh and the gun at the same time. for example fire gun input pressed → play gun firing animation on the gun → play recoil animation on the character.
over all its pretty simple. most items will sit in the players hand in one of two ways, either up or down. so when you import a melee weapon you would have it in the same orientation as the ib weps pack with the pointy end up. and for guns with a pistol grip you would orient the grip in an up down direction and the barrel would fall along the x axis for instance.
I still think that if there was an option like the one I said as an additional feature it would be better, but I suppose Ill do it like you said. So what your saying is to make the origin point for each weapon the location of where its going to be held. I took a look at the infinity blade pack but I dont get how that works, the socket is waaay out in the open and not even in the hand.
So I would have to make an animation for the weapon and the character to play simultaneously? Infinity blade: weapons doesn’t have any animations but is that the way they would have done it?
I get making the weapons origin the location at which it will be held and then rotate each weapon in the modeling program so that it fits the hold animation but gosh I think it would be a lot easier to have that done in the engine and to have it done in a way that doesn’t affect the base model.
and like I said from then on whenever the weapons will be spawned and having them all rotated on import it would spawn them with that rotation unless you counter acted it inside blueprints and also whenever you would place them in the world they would be all rotated and in a bad position. I also saw a trailer for a game in the unreal engine and a weapon was clipping through a characters hand.
Ok. But what about idle animations? like giving the item an idle animation and the character an idle animation, coz how did infinity blade get that working? Anyway Ill just do it the way ur saying.
for idle animations for the character you would just have to take into account if the socket is populated. so you may have a different idle for holding a gun vs empty handed. or you could sheath/ holster the wep. as for the wep animation just have it set to where if its not doing a firing animation its doing its idle just like a character would do.
Before you export your weapon make sure the have a proper point of origin and rotation (At the handle). And make different sockets for the weapons that can’t use the same socket, If a pistol can use the same socket as a rifle then fine, if it can’t then make a different socket for the pistol. If you really don’t want to deal with multiple sockets then you’ll have to deal with every single mesh’s point of origin to suit with your 1 socket and that’s even more tedious. If you think about it even in real life you wouldn’t hold spear the same way you hold a rifle, it just wouldn’t work out so you’d have to change the way you hold it to something completely different. It’s the same in the game world.