playMaker

Author Topic: Impulse force charging by holding the button  (Read 680 times)

regis

  • Playmaker Newbie
  • *
  • Posts: 1
Impulse force charging by holding the button
« on: June 28, 2022, 11:28:10 PM »
Need help with my first Unity / Playmaker project. In my 3D project I have an object that I want to throw in a certain direction by releasing the mouse button, but the force it is thrown should increase with the length I hold the button down before releasing it. I am using Add Force action set to impulse and throwing itself works fine, but I can't find a way to get the "charging" effect I mentioned.
At first I thought I need to use some kind of timer that would count the time between pressing a button and releasing it (to use that information to set a % of used force), but I didn't find anything like that. I haven't come across a single tutorial that could help me. How can I achieve this kind of effect?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Impulse force charging by holding the button
« Reply #1 on: June 30, 2022, 09:07:44 AM »
Hi.
Maybe you can use 'Float Add' , set every frame and per second.
To make sure it is to to high you can use a float clamp.