pixalsver/camera-api

There is no license information available for the latest version (dev-main) of this package.

a Pocketmine-MP API to use CameraPacket

dev-main 2024-07-08 16:26 UTC

This package is not auto-updated.

Last update: 2024-11-12 16:02:51 UTC


README

CameraAPI is an API that makes it easy to use the CameraPacket., Pixals Network Has Updated The Composer.json only, All Copyrights are reserved to the original author

Usage

Install SimplePacketHandler on your server

Register CameraHandler

if(!CameraHandler::isRegistered())
{
    CameraHandler::register($this);
}

Set Camera Instruction

// only the argument preset is compulsory
$setCameraInstruction = new SetCameraInstruction();
$setCameraInstruction->setPreset(CameraPresets::FREE()); //CameraPresets::FIRST_PERSON(), CameraPresets::THIRD_PERSON(), CameraPresets::THIRD_PERSON_FRONT()
$setCameraInstruction->setEase(CameraSetInstructionEaseType::LINEAR, 1);
$setCameraInstruction->setCameraPostion(new Vector3(100, 100, 100));
$setCameraInstruction->setRotation(0, 0);
$setCameraInstruction->setFacingPosition(new Vector3(0, 0, 0));
$setCameraInstruction->send($player);

Fade Camera Instruction

// no argument is compulsory
$fadeCameraInstruction = new FadeCameraInstruction();
$fadeCameraInstruction->setTime(1, 5, 1);
$fadeCameraInstruction->setColor(225, 225, 225);
$fadeCameraInstruction->send($player);

Clear Camera Instruction

// no argument is compulsory
$clearCameraInstruction = new ClearCameraInstruction();
$clearCameraInstruction->setClear(true);
$clearCameraInstruction->send($player);