Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm studying Unity3d, coming from a 2d background, and I'm a bit confused how some things work.

I'd like to slide a non-kinematic rigidbody, i.e. "just move it forward", like if it was hovering over the terrain. Applying a force makes a ball rotate forward, while I wanted it to slide forward without rotating, also unless that force is huge, a cube just won't move (for the same reason).

I understand there are kinematic objects which are "easier" to "just move", but I both think I might really need non-kinematic ones, and I think I need to understand them anyway.

edit: I did try to use some "rotation constraints/freeze", but they just prevented the sphere from moving at all.

share|improve this question
    
Off the top of my head, i would freeze rotation on the rigid-body on what ever axis you need, then i would play with the friction and up the force until you get the desired effect –  Steven Smith Nov 15 '13 at 11:40
    
@StevenSmith problem is that's what I think I've tried to do, and it just prevented the object from moving at all. But I'll give it another shot, maybe it needed more force to be pushed if it's frozen? –  Lohoris Nov 15 '13 at 11:52
1  
thats what im thinking, i reckon you need to adjust your friction, and up the force, as you object isnt allowed to rotate friction must play a huge part in the velocity of the object, so either down the friction or up the force...heck even both hehe –  Steven Smith Nov 15 '13 at 12:00
    
@StevenSmith that was right, it was just a matter of increasing the speed / decreasing the friction! –  Lohoris Nov 15 '13 at 20:07
add comment

1 Answer 1

up vote 3 down vote accepted

Thought I would post it as an Answer.

When wanting to manipulate a RigidBody, You need to take into account the given Physics when Not-Kinematic.

Many time in Games Dev there are 2 ways to Code Physics, Either follow the laws and implement them OR, fake the effect.

A lot of things that go wrong in Unity is when Realistic Physics meets, Fake mimic. Both work, Both are fine to use, but not really together.

In your case, I suspect your following the Real Physics root.

In this case you need:

  • Freeze the rotation on The Axis In question (provided by the Rigid-body Properties)
  • (TEST!) As the rotation is now effectively clamped, Any force applied Will have to compete with the Surface area Friction, one way to quick test is to set friction to practically nothing.
  • once confirmed Your force is being applied and the objects Velocity is Accelerating, You can then start Changing friction back to norm, whilst Adding more force to counteract the friction.
  • Alternative ways can also be Material of your surface, such as Ice etc.
  • Also Please note don't forget to manage your force, and use clamps, As soon as your object for what ever reason is not encountering friction your massive force will still be applied (pew pew woosh!)

Hopefully This has steered you in the right direction.

TL-DR: Your right! just need to remember to increase or decrease friction!

share|improve this answer
    
This worked, though now I'm stuck with dual air/ground friction... –  Lohoris Nov 16 '13 at 0:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.