Hello Everyone again,
I am currently trying to make a game similar to portal in which I am able to pick up blocks and place them on triggers and things happen. When I try to pick up the block I used Benny’s Example listed here:
My code looks like this but I dont seem to understand why the object does not follow the camera.
Is this possible or will I have to make button based puzzles instead of picking up and placing objects.
I am looking forward to your replies.
Below is a Blockly script that helps you getting started with picking up items with click, and then dropping the same item with click.
Explanation of the code
We define two function-blocks with one parameter for the item we like to set the pickup / drop behaviour on.
When the onActivate event from setPickupBehaviour is triggered, we call the drop-function to set the dropping behaviour.
The function block setDroppingBehaviour sets a new onActivate event. When the item is clicked, it’ll be detached from its parent (our camera). After the item is detached, we call the function setPickupBehaviour to pick up the item later again.
These two functions are all we need! At the start of the scene you simply call setPickupBehaviour for the items you want to be pickup-able.