diff --git a/src/main/java/cactusServer/models/CollisionManager.java b/src/main/java/cactusServer/models/CollisionManager.java index e0d85dd..7de6a2d 100644 --- a/src/main/java/cactusServer/models/CollisionManager.java +++ b/src/main/java/cactusServer/models/CollisionManager.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import org.ntlab.radishforandroidstudio.framework.model3D.CollisionResult; +import org.ntlab.radishforandroidstudio.framework.model3D.Position3D; import org.ntlab.radishforandroidstudio.framework.physics.PhysicsUtility; import cactusServer.entities.Character; @@ -41,9 +42,20 @@ for (Map.Entry character : characters.entrySet()) { result.add(PhysicsUtility.checkCollision(character.getValue().getObject(), "", object.getValue().getObject(), "")); + objectmove(instance.getValue(), object.getValue(), character.getValue()); } } } } + public void objectmove(Instance instance, Object object, Character character) { + int size = result.size() - 1; + CollisionResult current = result.get(size); + Position3D position = object.getPosition(); + position.setX(position.getX() + current.collisionPoint.getX()); + position.setY(position.getY() + current.collisionPoint.getY()); + position.setZ(position.getZ() + current.collisionPoint.getZ()); + object.setPosition(position); + } + }