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

Refactored BottleneckLowestPoint calculation #3

Merged
merged 1 commit into from
Oct 31, 2019

Conversation

Wully616
Copy link
Contributor

I reused the GetSlopeDirection function to figure out the direction vector the bottleneck plane was sloping towards.
Using this and the position of the bottleneck and the radius of the bottleneck I projected a position along the slope direction

You can see the yellow Debug.Line() always points to the lowest point on the bottleneck plane
https://gyazo.com/8c758804ec17321f9dd7fdcb904b3b65

The performance improvements are pretty good too, I tested by spawning 64 infinite liquid bottles angled so the function is called.
It reduces the GC allocation to 0B and the function self ms from ~2.8ms to < 0.1ms

https://i.imgur.com/C0LJNh1.png

@Macoron
Copy link
Owner

Macoron commented Oct 29, 2019

Damn, that awesome! I will test and pull it asap

@Macoron Macoron merged commit fedca90 into Macoron:master Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants