• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by alex 1 · Mar 14, 2011 at 01:12 PM · physicsrigidbodyaddforceforcerigidbodies

Add Force without Rotation

I've been playing around with the add force physics in Unity for a few hours now but have been stuck at this point for a long time -

I'm trying to add a force to an object, similar to thrust, that pushes the object from behind. I started by adding a force to a sphere, then using the smooth follow script to make the object follow it, this didn't work. It seems that adding force to a cube object comes out with some weird results for me.

How is it possible to make a object move forward, using add force, without it going 'Weird' and shaking all over the place?

I'm using a simple rigid body on the object, then using the line :

rigidbody.AddForce(transform.forward * 20); 

Yet my results are really quite weird. It seems to be that the spheres are fine with this, however cubes act it a strange way.

I decided to create an empty game object, added the script to it, then parented it with the other object making sure the empty game object was behind when parented, this still gave me some weird results.

Where am I going wrong here? What is it that I'm messing up on?

Thanks in advance,

~ Alex

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SirGive · Mar 14, 2011 at 01:22 PM 0
Share

are you using kinematic or gravity?

avatar image alex 1 · Mar 14, 2011 at 01:45 PM 0
Share

gravity [Space filler]

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by robertmathew · Mar 14, 2011 at 01:29 PM

unckeck the gravity box it will work fine because of gravity you have checked it is going like this

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image alex 1 · Mar 14, 2011 at 01:42 PM 1
Share

I still want to use gravity, I just want to exert the power from the empty game object, but move the object it's parented to.

avatar image robertmathew · Mar 14, 2011 at 01:56 PM 1
Share

rigidbody.useGravity = true

or false where you want to enable or disable the gravity

avatar image alex 1 · Mar 14, 2011 at 02:04 PM 1
Share

I understand that part - But at the moment what I know and have been told, I'm not getting any results, just a box sitting still..

avatar image robertmathew · Mar 14, 2011 at 02:21 PM 1
Share

if you use gravity the object will work according to the gravity only as you put gravity on first it will go down because of gravity then move forward to add force so change the code according to your need if you off the gravity it will move forward correctly

avatar image FLASHDENMARK · Mar 14, 2011 at 02:34 PM 2
Share

Why not freeze the rotation of the rigidbody? Is that what you are looking for?

avatar image
1

Answer by Bunny83 · Mar 14, 2011 at 08:02 PM

That sounds like a friction problem. If you try to push your cubboard across your carpet I'm quite sure it will tilt because it get stuck on the ground. You have two things you can try:

  1. Setup your PhysicMaterial of your box and the ground and set some low friction values to "grease" the movement.
  2. Use Rigidbody.AddForceAtPosition to lower the attack point where you apply your force.

The physics are designed to simulate the real world, so you need real world solutions ;)

ps. PhysicMaterial-component information

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Get result (force & torque) of AddForceAtPosition? 2 Answers

Why is force only being added in the same direction? 1 Answer

Rigidbody AddForce Problem ? 1 Answer

How can I convert velocity/direction to Force? 3 Answers

FixedUpdate vs. Update for instantaneous ForceMode's 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges