playMaker

Author Topic: Slowing down a rigid body...  (Read 1945 times)

bartleycollin

  • Playmaker Newbie
  • *
  • Posts: 18
Slowing down a rigid body...
« on: November 30, 2013, 10:43:18 AM »
I need some advice with this... I've been using playmaker for over a year now, but I haven't worked with Physics much at all.. Here's what I need help with

I'm creating a simple space game and I'm currently working on the Ship controller. I've been using the "Add force" action to move the object, and that works quite well. It give it the "Floating in the air" effect. My problem is, I'm not sure how I would go about slowing the force down. Right now if I stop pressing the left arrow key, the ship just glides for a while before gradually stopping.

tl;dr - How do I slow down a force?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Slowing down a rigid body...
« Reply #1 on: November 30, 2013, 12:59:00 PM »
Hi,

 to slow down, apply a force opposite to the direction of your gameobject, and apply a multiplier based on the current speed so that it brakes more when speeding and as it brakes the brake force is less and less ( else it would go backward at some point).

Otherwise, increase the drag of the RigidBody, that's very effective as well and simpler to implement.

Bye,

 Jean

bartleycollin

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Slowing down a rigid body...
« Reply #2 on: November 30, 2013, 02:07:41 PM »
Thanks Jean! I got it to work better by setting the drag property to 1 when it was on my Idle state.

1 more quick question. I'm happy with my controller, but the speed is a little bit too "icy" if you will.

Basically when I hit the left arrow, it takes to long for the ship to gain speed. It slowly builds up speed. I need it to be faster. Any tips?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Slowing down a rigid body...
« Reply #3 on: December 01, 2013, 01:38:01 PM »
Hi,

 I would set the drag to 0 when your user is controlling the ship, and then set it to 1 when the user not controlling it ( no user inputs)

bye,

 Jean