- Home /
Third Person: Picking up and carrying objects.
I want to be able to walk up to objects (i.e. a cube), and pick them up. Switching to an animation with the character holding the object, being able to throw or drop the object.
Now I have to say I'm extremely new to Unity and I'm currently using the script in Third Person Controller asset to be able to move my custom character around.
From tutorials I've been looking at this is what I've gotten, unfortunately I can only really find help with first person setups. So I'm unsure if Raycaster will still be applicable.
public class Pickupable : MonoBehaviour {
bool carrying;
GameObject carriedObject;
void Start () {
void Update () {
if (carrying) {
carry (carriedObject);
} else {
Pickup();
}
void carry(GameObject o) {
}
void pickup() {
if(Input.GetKeyDown [KeyCode.E]) {
??? Collider.onCollisionEnter ???
????
?????
}
I have an idea to use a non-physics collider around the pickupable objects as trigger to then be able to press "E" and pick up the object. But I have no idea how to script this.
Your answer
![](https://koobas.hobune.stream/wayback/20220612085559im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Use a capsule collider as a trigger to change a boolean statement. 1 Answer
Collisions with an animated character 1 Answer
How do I make animated .fbx file detect collision with another .fbx file? 0 Answers
How To Play A Different Animation When Bullet Contacts With A Certain Limb? 0 Answers
How to check rotations 1 Answer