Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planet's angle speed is not saved #20

Closed
mmarusiak opened this issue Apr 20, 2023 · 15 comments
Closed

Planet's angle speed is not saved #20

mmarusiak opened this issue Apr 20, 2023 · 15 comments
Labels
invalid This doesn't seem right

Comments

@mmarusiak
Copy link
Owner

If we save planets when moving and rotating, angle speed is not saved:

demoissueangle

@mmarusiak mmarusiak added the invalid This doesn't seem right label Apr 20, 2023
@mmarusiak
Copy link
Owner Author

By angle speed I meant agular velocity - that's how it's called in Unity actually.

@mmarusiak
Copy link
Owner Author

Footage of fix:
probably works

@mmarusiak
Copy link
Owner Author

Okay, it still does not seem right. Simulation is way too off on load.

@mmarusiak mmarusiak reopened this Apr 21, 2023
@mmarusiak
Copy link
Owner Author

Okay, it seems like wee need to also load and save inertia, which indicates how body's resistance in changing angular velocity.

@mmarusiak
Copy link
Owner Author

It looks like actually rotation of the planets is not saved and loaded properly.
Actually it is not saved at all...
weird

@mmarusiak
Copy link
Owner Author

It looks like actually rotation of the planets is not saved and loaded properly. Actually it is not saved at all... weird

Left side - screenshot of saved level;
Right side - loaded level in game;

@mmarusiak
Copy link
Owner Author

Now it seems like loading values to rigidbodies doesn't work correct:
(left side are values on "original session" and right side is on "loaded session")
weird2
weird1

@mmarusiak
Copy link
Owner Author

As far as I can see, values that doesn't match are rotation and velocity, which can be caused because we load those values before loading slices (slicing planets). So our planet is rotated and has some velocity and then sliced. We should keep these values and assign them once more after slicing probably, they are saved properly in data save file.

@mmarusiak
Copy link
Owner Author

Another discovery. I discovered that saving position is slightly off - probably we aren't saving correct position. Instead of planet position we are probably saving base position, which is at the center of slice.
weird3pos

@mmarusiak
Copy link
Owner Author

I don't have even idea what's wrong with loading stuff, but something is way off:
notworking

Seems like a bit of velocity. But I would go with that that in Unity I can't see option to save and set angular acceleration which body can actually have - it determines how angular velocity changes. So that would be my bet, but still not sure entirely sure about that. If that's actually the reason I think there's no way to approach what my goal here is.

@mmarusiak
Copy link
Owner Author

So my guess with angular velocity would seem like the issue here because when we're loading new planet/slice, the body has his angular acceleration equals zero, and goes entirely from zero not like on play, where it gains and just tweeks values that it gained because of contact etc.

@mmarusiak
Copy link
Owner Author

As far as I can see, values that doesn't match are rotation and velocity, which can be caused because we load those values before loading slices (slicing planets). So our planet is rotated and has some velocity and then sliced. We should keep these values and assign them once more after slicing probably, they are saved properly in data save file.

Actually rotation is saved and loaded fine - it has just different notation.
On the first one we got 360 + x;
And on the second we got just x;
So when x < 0, it looks odd, but everything with rotation is fine.
(I used eulers here ^)

@mmarusiak
Copy link
Owner Author

mmarusiak commented Apr 23, 2023

So only thing that is still off is velocity on the rigidbody, it somewhere needs to load weird values to it.

@mmarusiak
Copy link
Owner Author

Fixes issue as much as possible, there is no way to save and load angular acceleration, which is causing this issue. Checked all the other stuff, and save/load values are just the same.

def

@mmarusiak
Copy link
Owner Author

The best way to solve it is to make my own rigidbody, maybe will do it in future.

@mmarusiak mmarusiak pinned this issue Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant