mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-10-01 02:17:35 +00:00
Add an object type parameter for raycasting
This commit is contained in:
@@ -150,9 +150,10 @@ public final class CollisionManager {
|
||||
*
|
||||
* @param start The start position of the ray.
|
||||
* @param end The end position of the ray.
|
||||
* @param objectType
|
||||
* @return {@code true} if an impenetrable object was hit, {@code false} otherwise.
|
||||
*/
|
||||
public boolean raycast(Position start, Position end) {
|
||||
public boolean raycast(Position start, Position end, EntityType objectType) {
|
||||
Preconditions.checkArgument(start.getHeight() == end.getHeight(), "Positions must be on the same height");
|
||||
|
||||
if (start.equals(end)) {
|
||||
@@ -221,7 +222,7 @@ public final class CollisionManager {
|
||||
Direction direction = Direction.fromDeltas(currX - lastX, currY - lastY);
|
||||
Position last = new Position(lastX, lastY, start.getHeight());
|
||||
|
||||
if (!traversable(last, EntityType.PROJECTILE, direction)) {
|
||||
if (!traversable(last, objectType, direction)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user