Hello, I started tinkering with Unreal recently and I’m putting together a small prototype, but I’m not sure how to make the character’s tools, would it be better to have the tools like a compass and a shovel as components with a static mesh, and activate and deactivate them as they are used, or having them as actors?
Thanks for your help.
Hmm, never thought about having them as components. I would just create actor classes for them with skeletal mesh components on each and attach them to a socket on the skeleton. I have like ‘RightHandleEquip’, ‘LeftHandEquip’, ‘HipHolster’ etc sockets on the body, then just attach those actors to those sockets. You can just hide the actors when they aren’t ‘equipped’, or attach them to other sockets on the body to unequip them. Attach them to the right hand when they get used. Make sure to have some sort of rotation offset property so you can fix the rotation in the socket when attached.
If its something like Sea of Thieves where everyone has a set package of equipment (compass, spyglass, bucket, shovel) and everyone will always have those, the component route might work great. If its more of a dynamic situation with an inventory that is essentially unique at any given time, the actor/socket approach I think would be better.
Would the component approach work well for a throwable hook like the one on Raft? Or that would be better done with an actor?
This is kinda hard, I come from a web backend development background and even though I consider myself a decent programmer, architecturing game development is kinda overwhelming since I have 0 experience.
I think both approaches would work just fine, but I’ve never taken the component route for these types of things. To me spawning the actor in the world is the intended way to handle this. You might run into some issues trying to get something to work in a way it wasn’t intended. I’ve had issues with some components and activating/deactivating them. Not sure what the actual issues were but I’ve submitted bug reports, so I tend to stay away from them except the basic ones like ProjectileMovement. In my mind (and this may just be me personally), the components work best for behavioral code, and actors are for things that are going to spawn in the world and do stuff.
If I was going to create a Raftesque hook tool. I would create a class for it extending Actor (or extending a ‘Tool’ class that extends Actor), add a skeletal mesh to it that supports a few animations, create a socket on the hand of the character model (assuming first person, you’ll probably have only 1 or two of these), and attach it to that socket when its equipped.
This is a very straightforward way to implement equipment and I’ve had good success with this method.
I think I’m gonna go with the actor approach then, maybe since this is a pet project I’m going to test both ways given time just to learn a bit more.
Thank you for your help! Hope you are doing well!