playMaker

Author Topic: The speed.. IS TOO DAMN HIGH!  (Read 3246 times)

MajorIdea

  • Full Member
  • ***
  • Posts: 131
The speed.. IS TOO DAMN HIGH!
« on: December 10, 2012, 02:01:02 PM »
Hi all.

Is it possible to set a speed limit in playmaker? I have a cube controled by the player and to move it I use an Add Force. Thing is - I may set it to 7, but it seems to be additive (every frame)

How can I limit the velocity?

Auris

  • Playmaker Newbie
  • *
  • Posts: 4
Re: The speed.. IS TOO DAMN HIGH!
« Reply #1 on: December 10, 2012, 02:23:28 PM »
my guess is that this is a logic thing, that you are actually adding the force every frame.  probably don't need a limiter, but need to look at what stage in your game you are adding the force.  if you are adding the force inside an event that is also doing something every frame, then the add force may get repeated along with it.  try adding the force and then transitioning to an event that does other things, or set the Add Force to its own FSM and call it when you need it.

Auris.

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Re: The speed.. IS TOO DAMN HIGH!
« Reply #2 on: December 10, 2012, 02:31:21 PM »
I dont really see how. I think its as simple as can be right now - idle - get "W" key down - forward (apply force) - get "W" key up - idle.

It need to be every frame otherwise it would be just a burst.

I'm trying to use a float compare but I'm not sure if this is the one to use.

Something like:

Float 1 - Speed
Float 1 -0
Tolerance - 0
Equal - go_to_idle
Less than - go_to_idle
Greater than - brake

and its connected to  brake event

velketor

  • Junior Playmaker
  • **
  • Posts: 69
  • Multimedia Marathon Man
    • Shawn Kilian Portfolio
Re: The speed.. IS TOO DAMN HIGH!
« Reply #3 on: December 10, 2012, 02:40:01 PM »
make a variable to hold your 'speed' number.  then clamp that variable to a specific max number.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: The speed.. IS TOO DAMN HIGH!
« Reply #4 on: December 11, 2012, 04:59:52 AM »
Hi,

 check out this game:
https://hutonggames.fogbugz.com/default.asp?W936

the ball speed is constraint, this should help you find your way to do that too in your game:

https://hutonggames.fogbugz.com/default.asp?W942

bye,

 Jean

Red

  • Hero Member
  • *****
  • Posts: 563
Re: The speed.. IS TOO DAMN HIGH!
« Reply #5 on: December 11, 2012, 12:59:42 PM »
Also, maybe look into the "translate" action in the "transform" subsection of the action browser.

you can then use this with a float variable that you can add the values you want (the "Float Add" action also has a "per second" checkbox that can give you a nice and smooth animated value.) so, say i want it to move up when pressing "W" i can add in the appropriate actions to transfer the active state to this new one which will add "X" to the appropriate vector value on a per-second basis... so, it'll move up X units every second with a nice and smooth value.

and when you want to move out, you can use the "Get Key Up" action to wait until the "w" key is released and transition back.

something to keep in mind, however, is to ensure that the appropriate space is selected in the "Translate" action... you can tell it to use it's own native space or the world space but it's default is set to "self" space.
« Last Edit: December 11, 2012, 01:02:13 PM by Red »

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Re: The speed.. IS TOO DAMN HIGH!
« Reply #6 on: December 11, 2012, 01:18:45 PM »
I tried your translate approach but was having no luck with the Float Add. So I tried to use a Animate Float V2 for the ease in/out and it worked!... except, the ease out only works the first time. After that the character now comes to an abrupt stop as if the Animate float isn't there. Make no sense to me. i should play from the start everytime the action calls it, right?

I have - iddle - Get W keydown - forward ease in - get W keyup - glide ease out - idle/get W keydown

So close!
« Last Edit: December 11, 2012, 02:49:52 PM by MajorIdea »