playMaker

Author Topic: Add Force Problem  (Read 3251 times)

Nitrohex

  • Junior Playmaker
  • **
  • Posts: 50
Add Force Problem
« on: December 20, 2013, 07:32:47 PM »
Hello everyone,

I'm experimenting with add force action, and i noticed when i add a forward force
every frame to a cube with a rigid body component, the cube moves forward but not in a straight line, instead it deviates to left...

When i enable rotation restrictions on Y the it goes straight forward, but this is not what i need.

Anyone else has noticed this before, or m i doing something wrong here?

Thanks in advance

Sign Up Now @ StartApp.com

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Add Force Problem
« Reply #1 on: December 20, 2013, 08:43:59 PM »
Add Force has explicit controls for XYZ and also a vector input, if you want only forward movement just put a positive value in the Z slot and it will go forward.

You might get some weird direction changes if your ground surface is not perfectly flat. If you are doing this in 0 gravity with gravity turned off on the rigidbody then it will indeed only move on the Z. No other axis will be affected since there is no air friction or ground friction to deviate it.

There may be something else happening in your FSM's that is making it go to one side or the other, or perhaps you aren't using Self space on Add Force?

If you have a repro scene feel free to post it and I'll take a look.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Nitrohex

  • Junior Playmaker
  • **
  • Posts: 50
Re: Add Force Problem
« Reply #2 on: December 20, 2013, 09:06:24 PM »
Thanks Lane for the explanation,

my cube is on a flat terrain, has gravity/friction enabled and i apply force only in Z axis (in self space).

I not sure what can cause deviation of movement... cube has rotation of 0,0,0 terrain has no elevation (flat) and FSM has W,D keys for forward and backward movement (add force in Z + and -)

I will continue to experiment with settings, and if not succesful i will post a repo scene.
Sign Up Now @ StartApp.com

Nitrohex

  • Junior Playmaker
  • **
  • Posts: 50
Re: Add Force Problem
« Reply #3 on: December 21, 2013, 05:59:45 PM »
I did some more tests, and i find out that the coeff. of drag is doing the deviation.

When i have 0 drag, movement is as expected, but on 0.2 drag deviation occurs.

I also find out that the more the drag coeff does not mean more deviation from path.. its a matter of finding the sweet spot i guess..

I'm not sure if this is a physics engine glitch, or simply that's how the physics engine works in unity.

Any thoughts/similar situations on this issue?
Sign Up Now @ StartApp.com