This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
RESOLVED (but not the way I initially intended)
Hey all, I want to perform a sort of anti-boxcast, where instead of dragging a box along until it hits something, it drags a box along until the box isn't hitting anything. What's a good way of achieving that?
I have to achieve this in a single frame, so my best idea so far (create a box collider, move it along a vector in a while loop until it has no collisions) isn't optimal. But I'm not sure what else will do the trick.
Thoughts?
Edit: For those interested, I did end up resolving this by creating what I'm calling a "greedy boxcast", which effectively works by 1. Casting a chain of rays 2. Casting a chain of boxes 3. Finding the last time in the chain a box hits something and there is never another time a box hits nothing, or else using the max length of the ray
This allows me to fire sort of a hammer-shape to detect the furthest distance I can project my box safely.
I'm sure there is room to improve it, I am a bit rusty. Just as I've been writing this I realized I probably don't need the raycasts at all, but they helped a lot for visualization. I'm going to take a look at optimization soon as I am almost done with the functionality that this is being designed for and have to do some code reorganization to keep it sane anyway.
Next step, messing with some masking division and figuring out how I'm going to ricochet the greedy boxcast!
Or hammercast. That's kinda cool sounding. Feel like Thor.
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/Unity2D/com...