Hello, All.
I’m Kylin, I’m so glad to be right here to share my new challenge with you.
It’s KylinsEasyController
Completely free to get from Cocos Retailer: https://retailer.cocos.com/app/en/element/4207
Cautions
- This can be a very prime quality set of fundamental parts
- It’s free, as a result of I hope extra buddies can use Cocos Creator to make their very own passable merchandise simply and rapidly.
- To help me, click on on the writer’s title or seek for the key phrase kylins within the Cocos Retailer to buy my different objects. Cocos Retailer | Mr. Kylin
- Newest supply code and documentation:https://github.com/MrKylinGithub/free-meta-mmorpg-maker .
- For suggestions, please submit a problem in Github, or talk about within the Cocos discussion board.
Growth Setting
- Cocos Creator: v3.6.2
- Programming Language: TypeScript
A Easy Introduction
EasyController may be seen as a mix of EasyTouch, EasyJoystick, and EasyCamera.
A easy drag-and-drop and configuration will will let you management digital camera rotation and character motion in your telephone and pc.
Most important Options:
- Digital joystick
- Keyboard and mouse occasions handler
- Character Controller(transfer,leap,animate and collide with objects and so on)
- Digital camera Controller(ThrePersonCamera,FreeCamera)
Steps to make use of
Add digital joystick
-
Drag the ui_joystick_panel prefab from the EasyController folder to the Canvas.
-
The inexperienced space within the decrease left nook of the digital joystick is the motion space, when clicked on this space, the motion controller will seem to regulate the character motion. (When customers press the W, A, S, D keys, they’ll additionally management the character motion)
-
The purple space is used to regulate the digital camera, when click on and transfer on this space, you possibly can function the digital camera rotation, when the 2 fingers press and transfer, you possibly can alter the digital camera remark distance.
-
When urgent the house bar, you possibly can set off the character’s leap operate.
Add CharacterController
-
Drag the CharacterController element within the EasyController folder to the character object.
-
If the character is to be concerned in a bodily collision, ensure that the character has a Collider element and a RigidBody element.
-
If the character must play animations, please ensure that the character node has animation element.
-
Parameters of CharacterController:
- velocity Ahead motion pace
- jumpVelocity Upward pace on the time of leaping
- maxJumpTimes The utmost variety of jumps, 0 means can’t leap, 1 means can solely leap as soon as, N means can leap N instances repeatedly.
- idleAnimationClip Animation clip used for idle state
- moveAnimationClip Animation clip used for transfer state
- jumpBeginAnimationClip Animation clip used for leap start state
- jumpLoopAnimationClip Animation clip used for leap loop state
- jumpLandAnimationClip Animation clip used for leap finish state
ThirdPersonCamera
-
Add the ThirdPersonCamera element to the digital camera node that must be managed, normally the Most important Digital camera.
-
Parameters of ThirdPersonCamera:
- goal The goal to be adopted, normally the character node.
- lookAtOffset Offset of the goal place.
- zoomSensitivity Sensitivity when zooming digital camera
- lenMin Minimal remark distance
- lenMax Most remark distance
- len Default remark distance
- rotateVHSeparately Whether or not the horizontal and vertical instructions are rotated individually, when turned on, solely horizontal or vertical rotation might be carried out on the identical time.
- tweenTime tween time, Unit: second
Programming Guides
-
When the person operates the digital joystick or presses the keyboard or mouse, the corresponding occasion might be dispatched, and the occasion is dispatched by director.getScene().
-
Record of occasions:
- EasyControllerEvent.MOVEMENT Dispatched when shifting
- EasyControllerEvent.MOVEMENT_STOP Dispatched when cease shifting
- EasyControllerEvent.CAMERA_ROTATE Dispatched when rotating digital camera
- EasyControllerEvent.CAMERA_ZOOM Dispatched when
- EasyControllerEvent.JUMP Dispatched when leaping
- In your individual script, use director.getScene().on to hearken to the corresponding occasions.