Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Use the AnimationPlayer node for picking up items. You should be able to use it to position your character where needed (relative to the item) and temporarily switch to a camera where you can better see what is getting picked up before switching back to your main camera.  (you can trigger functions in the animation player)

For the different pickup and walking animations, you can keep track of these with a state variable in your player script. When you pick up the item, change the state in your player script to match:

if state == "carryPot": #run carryPot anim

elif state == "carryBucket": #run carryBucket anim

else: #run standard walk anim


For the log Animation, use a Raycast from your player to detect the log. 

add the log to a group, "log", and then in your player script, if Raycast is colliding with an object in the log group (you should be able to find the exact function to use in the documentation, it think it's raycast.getCollider().isInGroup() or something like that...) , change the state to something like "walkingOnLog" and adjust the animation accordingly like I mentioned above.


Hope this helps. Good luck on your project.

Thank you so much!

I will try to do something like that, especially I like the idea using RayCast for detecting the log, I didn't thought about that, that's brilliant, hmm ... if to think about it, I can try to use RayCast for detecting pickable items too, to detect which I can pick-up and which can't.

(1 edit)

For Pickable items, use Area / Area3d and then connect an on_area_entered() or on_body_entered signal() depending on what type you are using. If you are using a kinematicBody or RigidBody for your player, use on_body_entered(). Add your player to a group "player" and then check in the on_body_entered() function in the script if the colliding body is_in_group "player". Then write the script to trigger the animation if true.