Playmaker Forum

PlayMaker Help & Tips => PlayMaker Tutorials => Topic started by: AlolanEevee on January 10, 2019, 11:54:10 AM

Title: Can anyone help me with; Picking up, carrying around and placing objects down?
Post by: AlolanEevee on January 10, 2019, 11:54:10 AM
Been trying to work out how to get a basic object such as a cube to pickup, visibly carry in front of the player camera and be able to be dropped or placed in a specific area. I'm new to a lot of play-maker and someone mentioned ray tracing to me but that is absolute gobbledegook sorry if i'm being silly just want to know how i can achieve what I'm looking to achieve whilst learning in the process!

Thanks!
Title: Re: Can anyone help me with; Picking up, carrying around and placing objects down?
Post by: 4OnenightOnly on January 14, 2019, 01:14:47 PM
Yep. Me too. Desperate to find a step by step tutorial for this. Ideally want First Person perspective to pick up a box, spin it round to correct side and place on a shelf at various levels. :D
Title: Re: Can anyone help me with; Picking up, carrying around and placing objects down?
Post by: jeanfabre on January 15, 2019, 07:49:02 AM
Hi,

 you should try the custom action DragRigidBodyWithGo on the ecosystem, it will allow this kind of interactivity.

Bye,

 Jean
Title: Re: Can anyone help me with; Picking up, carrying around and placing objects down?
Post by: Thore on January 16, 2019, 07:03:27 PM
How you do this:

1) when pressing the pickup button (get button down), raycast in front to detect whether a box (the object to carry) is close enough. If so, store the box as variable. Later, this is used to move or teleport the box to the mount point.

2) Next, place an empty game object into your character’s hierarchy, where the box is being attached to, i.e. the mount point. Make it visible using the gizmo, put the box as zero transform under it as child, and move the mount around until it looks right. Now, you will run into a problem with the box’s rigidbody. Set the body type to simulated for now. You see, always try to achieve the effect “dry”, then you know what you need to automate later on.

3) Next, put the box back to the scene, change body type back. We now want to move the box from the scene to the bind point. This is simple in theory: after button press, and after the box is detected by the ray, in step 1, go to a next state. Here simply set parent the mount point to the box (as we did dry in step 2). Also use my action (http://"http://hutonggames.com/playmakerforum/index.php?topic=19487") to set the body type to simulated. Also, reset the position, or set it with an action. You should now be able to pick up the box. For dropping it, you need to do the same principle, unparent it from mount, for example.

4) Next, you can do the cosmetics. You want to make the ray short, or make the character walk close, and before attaching the box, play an animation (you do this with mechanim, where you can also make a “carry” state with extra animations, transitions etc). This will conceal the teleporting/set position/mounting of the box.

5) Good luck. The full system, with some decent polish can get quite intricate. You also have to watch dependencies: what happens when you jump while carrying, die while carrying etc. Hope that helps.