diff --git a/src/main/java/cactusServer/models/CollisionManager.java b/src/main/java/cactusServer/models/CollisionManager.java index d0a5485..4044ce6 100644 --- a/src/main/java/cactusServer/models/CollisionManager.java +++ b/src/main/java/cactusServer/models/CollisionManager.java @@ -87,6 +87,15 @@ } } } + + public void collisionMove(Player player1, Player player2) { + CollisionResult result; + result = PhysicsUtility.checkCollision((Object3D)player1.getPlaceable(), null, (Object3D)player2.getPlaceable(), null); + if (result != null) { + System.out.println("�v���C���[���m���Փ�"); + objMove(result, player1, true); + } + } private void objMove(CollisionResult result, MovableObject object, boolean negate) { result.normal.scale(-1); @@ -97,6 +106,15 @@ object.setPosition(new Position3D(vec)); } + private void objMove(CollisionResult result, Player player, boolean negate) { + result.normal.scale(-1); + Vector3d vec = player.getPosition().getVector3d(); + if (negate) + result.normal.negate(); + vec.add(result.normal); + player.setPosition(new Position3D(vec)); + } + private void collisionBulletsAndOthers(String instanceId, Instance instance) { collisionBulletAndOtherBullets(instance); for (Map.Entry> playersBulletsEntry : instance.getBullets().entrySet()) {