Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
2
Question by mabit · Feb 11, 2012 at 11:45 PM · transformtranslatetime.deltatimeridigbody

transform.Translate by Time.deltaTime

I have 4 objects, Blue, Red, Yellow, Green.

They all have this line of code:

 transform.Translate(Vector3.forward * Time.deltaTime*5, Space.World);

However they all seem to move at different speeds...Yellow slowest, then Red, then Blue and Red much faster.

I need all the object to move at exactly the same speed so I thought this would be perfect, but as it is they end up colliding with each other and making a mess.

They are all rigid bodies with a mass of 1.

Any suggestions would much appreciated.

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 Eric5h5 · Feb 12, 2012 at 12:02 AM 0
Share

That will result in the same speed outside of other factors. $$anonymous$$ass is irrelevant when directly translating them.

avatar image mabit · Feb 12, 2012 at 01:38 AM 0
Share

It would appear it is an issue when importing from 3DS $$anonymous$$ax. The objects are at different scales. The bigger objects move faster even though they are the same size in Unity. The box colliders on them were

Yellow = 2.6 x 6 x 2.2 Red = 23 x 15 x 17 Blue = 1 x 1 x 1

Like I said when they are in Unity they are all the same relative size but these weird scales must be something to do with it.

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Bunny83 · Feb 12, 2012 at 02:12 AM

Ok, i just tried many things. First i thougt you might have different parents for each object and everyone with a different scale. However that has no influence on the speed since you move in world-space.

To cut it short: No matter what i do to the setup, i can't make them move at different speeds. The only thing left over is that you have another script that moves the object. Since it's a rigidbody it's possible that you set a velocity or a one-time AddForce (which is pretty much the same) somewhere. Check the velocity of all rigidbodies, they should be (0,0,0) since you move them without physics.

When they are Rigidbodies you might just want to set a velocity?

 // Unityscript (Javascript)
 function Start()
 {
     rigidbody.velocity = Vector3(0,0,5);
 }

This will make the object move along the positive z-axis at a speed of 5, just like your piece of code above. Note: that only works for non-kinematic Rigidbodies. If you have a kinematic RB you have to move it "manually" like you already do.

Comment
Add comment · Show 1 · 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 mabit · Feb 12, 2012 at 04:08 PM 0
Share

Hey, thanks for taking the time to have a look into this. It was only the one line of code that was for the movement. I have shown this problem to my Uni lecturer and he is baffled by it too.

The only difference is the relative size of the objects. I have made them all 1 x 1 x 1 cubes from within unity and it is working fine, but as soon as I bring in the 3DS models it is going out of sync.

I will try out this suggestion when I get in from Uni and see how it goes.

avatar image
1

Answer by Berenger · Feb 12, 2012 at 02:07 AM

If they have gravity, it might come from the friction. Are they kinematic ? I don't think the scale before or after the import have any effect.

Comment
Add comment · Show 1 · 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 Bunny83 · Feb 12, 2012 at 02:19 AM 0
Share

Good point!

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.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

instantiate,destroy,gain speed in time 2 Answers

Tranform.translate does not have constant speed 1 Answer

time.Deltatime not counting Upwards 1 Answer

Match position of two object without making one a child of the other 4 Answers

Wait a fraction of a second within a Function Update() 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges