playMaker

Author Topic: Adding constant force to a vector[SOLVED]  (Read 2380 times)

LOLinc

  • Playmaker Newbie
  • *
  • Posts: 2
Adding constant force to a vector[SOLVED]
« on: March 03, 2014, 09:01:31 PM »
Hi there!

I am still a bit new to Playmaker, but I really enjoy it so far  :D
However, I'm in need of a little help here:

I am making a game where you are controlling a ball with a rigid-body. As it is right now I use "Get Axis Input" and "Add Force" stored in vector3-variable. This works fine, so far so good. But in my current set up there is only added force to the ball when the player use the W,A,S,D keys. What I want to achieve is a force (around 50) that is constantly pushing the ball in the direction of my vector3 variable - also when the player isn't pushing any keys. So if the player isn't pushing any keys, the constant force should simple be applied towards the last stored vector3 direction. In other words: if the player pushes "left", then there will be add force to the left until the player pushes another key.

Any ideas or suggestion on how I could achieve the control system mentioned above?

I hope this wasn't to unclear - thanks for reading.

Cheers
« Last Edit: March 11, 2014, 06:33:27 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Adding constant force to a vector
« Reply #1 on: March 04, 2014, 06:20:05 AM »
Hi,

 you should have two fsm, one that apply the force given a vector 3 variable and another fsm that listen to user inputs and set the vector3 of that other fsm when needed.

 so if the user press left, you set vector3, and you only set this vector when the key is actually pressed, you can still listen to key up events to come back to a state where you listen to all possible keys, but that won't be affecting the other fsm adding forces.

hopw that make sense?

also, have you checked the m2h examples there is a ball rolling sample done all in playmaker, that could help you as well.

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

bye,

 Jean

LOLinc

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Adding constant force to a vector
« Reply #2 on: March 10, 2014, 07:51:20 PM »
Thanks a lot - I figured it out..