diff --git a/src/main/java/cactusServer/models/CollisionManager.java b/src/main/java/cactusServer/models/CollisionManager.java index 9b2524b..16034c9 100644 --- a/src/main/java/cactusServer/models/CollisionManager.java +++ b/src/main/java/cactusServer/models/CollisionManager.java @@ -7,6 +7,8 @@ import org.ntlab.radishforandroidstudio.framework.model3D.CollisionResult; import org.ntlab.radishforandroidstudio.framework.model3D.Position3D; import org.ntlab.radishforandroidstudio.framework.physics.PhysicsUtility; +import org.ntlab.radishforandroidstudio.java3d.Vector2f; +import org.ntlab.radishforandroidstudio.java3d.Vector3d; import cactusServer.entities.Character; import cactusServer.entities.Instance; @@ -47,17 +49,24 @@ public void collisionMove(Object object, Player player) { CollisionResult result; - result = PhysicsUtility.checkCollision(player.getObject(), "", object.getObject(), ""); + result = PhysicsUtility.checkCollision(player.getObject(), null, object.getObject(), null); if (result != null) { - + result.normal.scale(-1); + Vector3d vec = object.getPosition().getVector3d(); + vec.add(result.normal); + object.setPosition(new Position3D(vec)); } } public void collisionMove(Object object1, Object object2) { CollisionResult result; - result = PhysicsUtility.checkCollision(object1.getObject(), "", object2.getObject(), ""); + result = PhysicsUtility.checkCollision(object1.getObject(), null, object2.getObject(), null); if (result != null) { - + Vector3d vec1 = object1.getVelocity().getVector3d(); + Vector3d vec2 = object2.getVelocity().getVector3d(); + if(vec1.length() > vec2.length()) { + + } } } }