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 Joe 9 · Oct 19, 2010 at 02:12 PM · physicsrigidbodymultiplayertrajectoryprediction

Predicting A Trajectory

Hi,

I need to be able to predict the trajectory that a rigidbody will take for client side prediction, as such I can't create an invisible object and then collect the data, as it needs to be calculated as quickly as possible.

Is there any way built in to fake a physics timestep on a particular rigidbody? Or will I need to roll my own?

Cheers J

Comment
Add comment · Show 6
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 fzzr · Oct 19, 2010 at 04:26 PM 0
Share

That sounds like what interpolation does for you. See here: http://unity3d.com/support/documentation/ScriptReference/Rigidbody-interpolation.html?from=RigidbodyInterpolation

Not sure if this is what you had in $$anonymous$$d though, or if you need direct access, so I'm leaving this as a comment.

avatar image Joe 9 · Oct 19, 2010 at 05:29 PM 0
Share

No I don't need to interpolate the physics, I need to predict the physics before they happen. As in client side prediction I need the ability to rewind to a previous physics state, and resimulate the path that an object took.

avatar image overunity3d · Sep 24, 2011 at 04:58 PM 0
Share

I am having the same problem with a trajectory. It has been a year for you. Have you reached an answer?

Thanks in advance.

avatar image keld-oelykke · Sep 25, 2011 at 08:48 PM 0
Share

Good question. The global time scale affects all objects, so that is not a solution. Is this feature possible with PhysX? If not, Unity prob. won't get it either, since it builds physics on-top of PhysX.

avatar image syclamoth · Sep 26, 2011 at 10:38 AM 0
Share

Well, if you use unity's physics data to predict something using your own physics simulation, as long as it's only a few frames into the future and you are only doing it on specific, 'important' objects, the inaccuracies shouldn't be too bad, and the CPU overhead shouldn't be huge.

Show more comments

1 Reply

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

Answer by Joe 9 · Jan 06, 2012 at 12:56 PM

In the end I managed to just about get everything I needed by attaching a charactercontroller to an object, rolling my own basic rigidbody script using the equations of motion, namely s = ut + 0.5at^2, and then updating velocity with v = u + at. Then I move the charactercontroller with the move() function, and process collisions in OnControllerColliderHit().

It's far from ideal, and means I have physics limited to what I implement myself in OnControllerColliderHit(). I also use this new rigidbody script as a replacement for the unity one, as this will certainly disagree with PhysX when any kind of complicated collisions happen.

For anyone interested, I needed to do this for a rewind-and-replay client-side prediction algorithm for a multiplayer FPS. I've come to realise that at present, Unity probably isn't a suitable engine for a multiplayer FPS which requires a robust networking model.

One possible way to do this would be to compile an existing physics engine (e.g. the excellent and open-source Bullet physics SDK) into a plugin, it would take a fair amount of work, and I have no idea how well it would perform what with passing data between unity and the plugin, but it's the only decent solution I can think of.

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.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Turn-based vehicle physics 1 Answer

2D projectile trajectory prediction 2 Answers

Calculating rigidbody top speed? 3 Answers

Networked Physics 0 Answers

Networking: Client Side Prediction with Inertia 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