playMaker

Author Topic: Throwing object  (Read 943 times)

christrejo2257

  • Playmaker Newbie
  • *
  • Posts: 6
Throwing object
« on: January 19, 2022, 12:40:21 AM »
im trying to recreate the last of us bottle/can throw. i want my character to throw an object with a trajectory path and make a noise to attract ai when it lands how would i go about this? i cant seem to find any tutorial on this or closely related.

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Throwing object
« Reply #1 on: January 19, 2022, 03:07:22 AM »
The system that you wanted actually consists of multiple systems.

1. The throwing itself and its physics, I assume you want the thrown object to behave according to real-world physic. Start by making this first, which I believe there are many tutorials available.

2. The event that emits the radius of the sound noise whenever the object makes contact with its surroundings. Something like a trigger.

3. AI behavior to respond whenever he/she receives event no 2

4. AI Pathfinding, The logic for the AI on what to do next whenever he reacts, Maybe chasing the player, etc, etc...

Rather than searching for a whole system tutorial, try to break it down and search each part's tutorial instead.

Happy Developing!

christrejo2257

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Throwing object
« Reply #2 on: January 20, 2022, 11:27:40 PM »
how would i go about throwing an object? i cant find any tutorials on this

Twood

  • Junior Playmaker
  • **
  • Posts: 76
Re: Throwing object
« Reply #3 on: January 21, 2022, 12:22:38 AM »
You'll I assume want to add things to this but one simple way to start experimenting is put a Rigidbody component on a game object, like a cube or whatever as the throwing object.

Now place another object in the scene as your target that you're going to throw at.

Now you could throw something at it with only two playmaker states.


1st state. In Playmaker on your cube, use a "Look At" action first and set its target to the target you want in scene. This will align it's forward direction with the target. Now add something after the Look At action to start your throw, like Get Key Down or whatever.

2nd state. Then when you fire the target however you want, add another state with the "Add Force" action that it transitions to. The settings for add force could then be something like (depending entirely on scene size) Y - 10 (the upward force) Z - 20 (the forward force)  space - self (world can't ever rotate the directions so you must use self here) force mode - impulse.

Your object will fly, and changing the numbers will change how hard it will go towards the target. Changing the physics settings under Rigidbody will also have huge effects.

TrueSoSense

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Throwing object
« Reply #4 on: January 23, 2022, 03:07:23 PM »
I found a tutorial on youtube...
It may be helpful.

christrejo2257

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Throwing object
« Reply #5 on: January 24, 2022, 10:33:41 PM »
so it works perfectly the only problem is that if i have keep gravity on the rigid body checked it falls out of my characters hand and threw the floor how would i fix this thanks again for your help

TrueSoSense

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Throwing object
« Reply #6 on: January 28, 2022, 01:01:54 PM »
Disable gravity when the character is holding it, enable it when he throws/drops it.