Quantcast
Channel: Questions in topic: "parenting"
Viewing all articles
Browse latest Browse all 302

Piling up objects and transporting them

$
0
0
Hello Everyone, I'm trying to work on a mechanic where the player is holding a box and they need to catch and pile pizzas that randomly fall from the sky. In order to make this work I have been trying to parent each pizza prefab to the box or another pizza through the two colliders touching, recognizing the gameobject's tag and creating a parent-child relation so that the pile of pizza follows the player moving. (the player can only move on a constrained horizontal axis). The mechanic works, but I am having two issues with it: ---------- -Since it's a parenting based mechanic, the pizza prefabs remain still once piled. I am activating the kinematic function on their rigidbody once they touch the collider of the last piled pizza. This does not allow to have a more "realistic" effect where the pile has a small delay in following the player's movement (especially at the top). I had to do this so that the pizzas would not fall when the player hit the border of the axis where they can move. ---------- -The second problem comes from the fact that I'm using colliders to make this work. If you have a large pile of pizzas and try to catch one with the side of the pile, this sticks on the side and does not keep falling as it should. I've tried giving multiple colliders to the pizza prefab, but it still acts in the same way. ---------- Please let me know if you have any suggestions on how to improve this. I believe that a physics based mechanic would work the way I want, but the problem is that, once caught, the pizzas slide down when the player moves. ---------- Here is a video showing the issue: https://www.youtube.com/watch?v=Xh4yBkHN9ws&feature=youtu.be ---------- Thank you for your time!

Viewing all articles
Browse latest Browse all 302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>