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
1
Question by PrimeDerektive · Aug 30, 2012 at 04:38 PM · transformcharactercontrollernetworkperformancemove

Does moving a charactercontroller via it's transform hurt performance?

Does it need to recalculate the collision data of the scene every frame? Should you only move a CC with the move functions?

I ask because I'm trying to determine the best way to handle proxy players in a network environment. The easiest solution with the least bandwidth usage would be to just modify the transform on proxies, but I'm not sure how badly it will hurt performance.

Comment
Add comment · Show 1
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 PrimeDerektive · Aug 30, 2012 at 05:01 PM 0
Share

Everyone knows UnityAnswers is for wasting time at your day job, where you are pondering Unity quandaries that you can't test at work!

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Matt-Downey · Aug 31, 2012 at 07:00 PM

I'm almost positive transform.Translate is cheaper than rigidbody.MovePosition.

If you use rigidbody.MovePosition, the object will sweep out the space afaik to make sure the object interacts with all of the other objects in it's path. If you wanted realism in a sea of soccer balls for example, MovePosition would probably push the objects in front of you outwards in waves through physics (with a little extra overhead), whereas transform.Translate would push them out of the position to which the player teleported (not moved), which could make the soccer balls behave more erratically as the player reached higher speeds.

Also, If I'm not mistaken, rigid.MovePosition will not move to the position it is told to move to per se. In reality rigid.MovePosition will try to move to a position, but if it's path is blocked it will try to get as close as possible.

transform.Translate will probably be cheaper, since it is a form of teleportation that doesn't use physics at all.

The rigidbodies interact with colliders and physics more than the transform afaik. For instance, rigidbody has a SweepTest function, which determines the first collision between an object and its environment if it were moved. The transform class on the other hand has no such functions.

So yeah: rigidbody-->physics; transform-->teleportation

[edit:] and since you are using CharacterController.Move that is going to be even more expensive than physics in most likelihood, since it has to calculate everything related to move in the CharacterController script and then perform physics.

Comment
Add comment · Show 4 · 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 landon912 · Aug 31, 2012 at 07:59 PM 0
Share

$$anonymous$$akes sense so I would agree, that useing the transform to move would save lots of bandwidth and give better performance since it doesn't have to run the physics for it.

avatar image Matt-Downey · Sep 01, 2012 at 03:54 AM 1
Share

Usually people send 1) input over the server 2) the desired position or 3) the delta vector (small change in position). You can send more (often redundant) information but for the most part you should just send the position, input, or the change since the last frame.

Running physics is going to overload the CPU and slow down the game, but that has nothing to do with bandwidth.

The colloquial lag the player perceives could either have to do with unresponsiveness from bad ping time that isn't compensated by client side prediction or it could be from your game overloading the CPU.

You seem to be talking about lag caused by overloading the CPU, which might more accurately be called something else, usually the lag (when correctly termed) has to do with bad connection to a network.

Regardless, you don't want to make a ton of calculations, so it's good practice to start by just sending the position of the player over the network for now:

if you want to try to optimize, look into the types of data that can be sent over the network:

http://docs.unity3d.com/Documentation/ScriptReference/BitStream.Serialize.html

and an approximate cost (it might be more due to sending variable names or less due to compression; I have no idea):

http://www.cplusplus.com/doc/tutorial/variables/

char ~= 1 byte float ~= 4 bytes, etc

avatar image Fattie · Sep 01, 2012 at 08:38 AM 0
Share

You should listen to what $$anonymous$$att says - there are many confusions stated about networking in the other posts and $$anonymous$$att has cleared it up.

Also just so you know as a very general principle. It is petty much utterly inconceivable that the amount of information you are sending makes any difference whatsoever. You're out by orders of magnitude worrying about that.

So again every word of $$anonymous$$att's here is gold, I suggest to all readers to study it !

avatar image Matt-Downey · Sep 04, 2012 at 03:20 AM 0
Share

Thank you very much for the words of praise. You made my day!

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

9 People are following this question.

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

Related Questions

Character controller not following moving parent transform properly 3 Answers

Instantiate VS Transform 1 Answer

CharacterController Move vs. SimpleMove 1 Answer

Is it possible to get transform.Translate() to move like CharacterController.Move()? 0 Answers

Expense of CharacterController.Move 0 Answers


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