Hi everyone, this is Francesco writing from Italy.
I'm a newbie and this is my first post, so please be kind!
I run across a problem with playmaker and, after a lot of pointless attempts in the past weeks, I realized I might need some help from the experts.
Here is the problem:
Just like a cilinder-shaped vertical pin popping up and hitting a marble, I'm trying to have a similar game object "jump" on its Y axis, hit another game object (a sphere with rigidbody component attached) and then revert to its original position.
I'd like to have the "pin" movement and the force applied to it to be proportional to the length the user keep a certain key pressed, until a max time value (let's say 2 seconds).
This would allow me to simulate a slight touch as opposed to a strong hit, and all the gradient inbetween.
I tried to split the problem in various bits (which might as well be placed in different fsm, where needed)
So far, I have been doing the following:
To get the time length a key is pressed:
1: get key down
2: get time info (in current state) and store value to a float variable "time" (clamped to the max value of 2)
3: get key up
..so far so good..
then comes the part where I have to convert the float value (which range from 0 to 2) to something usable for the movement/force applied.
This is the part where I am messing up badly
Here's the logic I've been following:
4: sample curve (here I'm sampling the value of "time" float variable over a custom curve and store the result in another float variable "power", in order to turn it into somehing more usable for movement/force)
5: add force (using the "power" varaible over the y axis)
Well, the pin moves but quite oddly, even after a lot of tweak of the curve.
I'm unexperienced enough to believe that the whole problem can be solved in a more solid and reliable way, but I can't figure out how. (maybe using spring/configurable joints?)
Is there anybody who can put me on the right track?
Appreciation to anyone who will help and congrats to the developer of this great tool who made a noob like me quite able to prototype a game!