stacked boxes, Help me please.

Blitz3D Forums/Blitz3D Programming/stacked boxes, Help me please.

Yue(Posted 2015) [#1]
Hi, I need to know how the character can make a box that is on top of another.

What I need is that if I have three boxes on top of each other, can make the above and take it away, then come back and take the second, hata get to the last one it is on the floor.

What not to do is select that box, which can make the first box in the top of the tower of boxes.

Any suggestions?




Flanker(Posted 2015) [#2]
One simple solution is to parent your boxes to a pivot, the lowest box first, and the highest box last. Then, if your player is near the boxes pivot, you can access the highest box with GetChild(boxes_pivot,CountChildren(boxes_pivot)), the last child will alway be the highest box if you respect the order. An example :




stayne(Posted 2015) [#3]
Here's my quick and dirty take on it. Get close to a box and click it to pick it up. Click anywhere else to drop it.

Go ahead and rip me a new one Stevie :)




Stevie G(Posted 2015) [#4]
From what you say, you can only pick up a box if it is not in contact with an entity above it.

If you're using a physics package it should be easy enough to find out this contact information and set a flag per entity to true or false so indicate whether it can be picked up. Then if the player is close enough to an entity with the true flag, pick it up.

You may need to explain a bit more about what contact/collision information is available to you.