Mobile Touch Floating Joysticks with Options 1.0操纵杆
The comments in the code for the joystick(s) help you understand how it (the joystick itself) works.
The code runs on mobile (android and ios) devices, it does not run on PC.
You must develop the code on your PC and use the Unity Remote app (see Unity Documentation) in order to run the code on your mobile device to see if it works.
This package is made both for people who are comfortable with code and/or those who wish to have a scene that is fully functional in terms of player control where you use the joystick(s), and it controls the player with animations.
The code of the joystick (C#) is fully commented so that you can fully understand how it works.
To explain, the joystick itself generates a normalized direction vector as the user drags their finger on the visible portion of its background image.
It generates values in the x between -1 and 1 and y values between -1 and 1. It works as if moving a point on a trigonomic unit circle.
You can get this input data by calling the GetInputDirection() function of the joystick.
You can read the comments in the code to understand in full how the joystick generates this data.
There are 4 functional demos in this package. Each one demonstrates a different setup of the joystick. Each one controls the player character movement with the joystick. The player character is a 3d humanoid model with mechanim animation clips that are triggered to run in the code.
You can use the demos as they are and/or modify them in code for your own project.
You can replace the images that make up the joystick with your own.
You can use the 3d models (character and pistol) and animation clips freely in your own projects and/or replace them with your own.
uses Unity UI that came out in unity 4.6
floating joysticks, half-screen limited or not, with optional settings for always fixed, always visible
-appears where the screen is touched, disappears when that touch ends
-drags along with the finger (floating joystick)
-each joystick can be optionally set to always stay fixed / stay visible
includes 4 demos, each controlling a player character with animations, as seen in the video
dual joystick demo - are 2 joysticks, left joystick's movement and position limited to the left-half side of the screen, right joystick's movement and position limited to the right-half side of the screen
single joystick demo - is 1 joystick, this single joystick can be moved and positioned anywhere on the screen
single left joystick demo - is 1 joystick, this left joystick's movement and position limited to the left-half side of the screen
single right joystick demo - is 1 joystick, this right joystick's movement and position limited to the right-half side of the screen
操纵杆代码中的注释有助于你理解它(操纵杆本身)的工作原理。
这些代码可以在移动(安卓和IOS)设备上运行,但不能在PC上运行。
你必须在你的电脑上开发代码,并使用Unity Remote应用程序(见Unity文档),以便在你的移动设备上运行代码,看看它是否有效。
这个软件包是为那些对代码很熟悉的人和/或那些希望拥有一个在玩家控制方面功能齐全的场景的人制作的,在那里你可以使用操纵杆,它可以用动画控制玩家。
操纵杆的代码(C#)是完全注释过的,这样你就可以完全理解它是如何工作的。
解释一下,当用户在其背景图像的可见部分拖动他们的手指时,操纵杆本身会产生一个归一化的方向矢量。
它产生的x值在-1和1之间,y值在-1和1之间。它的工作原理就像在一个三角学单位圆上移动一个点。
你可以通过调用操纵杆的GetInputDirection()函数得到这个输入数据。
你可以阅读代码中的注释来全面了解操纵杆是如何产生这些数据的。
这个包里有4个功能演示。每一个都演示了操纵杆的不同设置。每一个都是用操纵杆控制玩家角色的移动。玩家角色是一个3D人形模型,带有机械动画片段,在代码中被触发运行。
你可以按原样使用这些演示和/或为你自己的项目修改它们的代码。
你可以用你自己的图像来替换构成操纵杆的图像。
你可以在你自己的项目中自由地使用3D模型(人物和手枪)和动画剪辑,并且/或者用你自己的模型替换它们。
使用unity 4.6中出现的Unity UI。
浮动操纵杆,半屏限制或不限制,可选择设置为始终固定,始终可见
-在屏幕被触摸的地方出现,触摸结束后消失
-随着手指拖动(浮动操纵杆)。
-每个操纵杆可以选择性地设置为始终保持固定/保持可见
包括4个演示,每个演示都控制一个带有动画的玩家角色,如视频中所示
双操纵杆演示--是2个操纵杆,左操纵杆的运动和位置限制在屏幕的左半边,右操纵杆的运动和位置限制在屏幕的右半边
单个操纵杆演示--是一个操纵杆,这个单一的操纵杆可以在屏幕上的任何地方移动和定位
单个左操纵杆演示 - 是1个操纵杆,这个左操纵杆的移动和位置仅限于屏幕的左半边
单一右操纵杆演示--是1个操纵杆,这个右操纵杆的移动和位置只限于屏幕的右半部。
页:
[1]