-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix rotation axis #8
Conversation
Awesome, thanks @shantanuwadnerkar! Are you able to test this out in the player by any chance, i.e. by playing it in the sim? In my experience, that's the best way to verify things act and feel like you expect. |
I'm not able to see any notable change on the visual aspect. But then, I didn't change anything with the visualization. Changes are only in the _get_rect() function. Also, the collision points are offset by a bit in the visualisation, meaning, I can see those rectangle vertices outside the vehicle dimensions. |
Oh, perfect. So you can actually see the difference! Mind posting a video?! I will check it out locally asap as well. Thanks @shantanuwadnerkar! |
Sure! Here it is: https://youtu.be/EAPtSnOZW8Y Check out the video description for comments. Let me know if you have any problems. Waiting for your feedback! |
Nice job getting it running! Interesting, it looks like the rectangles have the wrong offset, but perhaps are indeed rotating around the rear axle now. I think we'd be able to tell if the rectangle and vehicle sprite angle were calculated the same way. Right now arcade is controlling the rotation of the sprite in player.py via a single |
@shantanuwadnerkar Actually I realized a much simpler way would be to just calculate a new center by rotating the center around the rear axle as well. Then calculate a shift plus rotation around center to pass to arcade for rendering. Does that make sense @shantanuwadnerkar ? |
That does make sense, @crizCraig . In fact, I was trying to do the same. Let me rework the formulas. I'll also introduce what are called homogeneous matrices so the transformation can be a one step computation for all the points, including four rectangle vertices, and the center. Things will be more clear when I push the actual equations. |
Also added numba decorator over bike_model/get_vehicle_dimensions() to reduce the number of changes made to functions. Need to change the test cases to account for the new calculation of rotation matrices.