Я думаю готовых полно скриптов для фпс, но вообще про ScreenWidth и ScreenHeight почитай в справке. Можно указать координаты не как постоянный а как относительные типо (screen.Wigth/2 , screen.Height/2 , 1). Но я могу ошибаться!!!)
Эммм... Это мне адресовано? Что вам, собственно говоря, не нравится в скрипте. Если он не рабочий, то скажите!
public class Pricel : MonoBehaviour { public Texture2D textura; Rect position;
// Use this for initialization void Start () { position = new Rect((Screen.width - textura.width) / 2, (Screen.height - textura.height) / 2, textura.width, textura.height);
}
// Update is called once per frame void OnGUI () { GUI.DrawTexture(position, textura);
Хммм... Да мне как то пофиг на перевод! Что сам не могу - гугл-переводчик или промт поможет!и всё ок! Справку от unity3d.ru я недолюбливаю. Поэтому юзаю с офф сайта!
// Use this for initialization function Awake () { motor = GetComponent(CharacterMotor); }
// Update is called once per frame function Update () { // Get the input vector from kayboard or analog stick var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
if (directionVector != Vector3.zero) { // Get the length of the directon vector and then normalize it // Dividing by the length is cheaper than normalizing when we already have the length anyway var directionLength = directionVector.magnitude; directionVector = directionVector / directionLength;
// Make sure the length is no bigger than 1 directionLength = Mathf.Min(1, directionLength);
// Make the input vector more sensitive towards the extremes and less sensitive in the middle // This makes it easier to control slow speeds when using analog sticks directionLength = directionLength * directionLength;
// Multiply the normalized direction vector by the modified length directionVector = directionVector * directionLength; }
// Apply the direction to the CharacterMotor motor.inputMoveDirection = transform.rotation * directionVector; motor.inputJump = Input.GetButton("Jump"); }
// Require a character controller to be attached to the same game object @script RequireComponent (CharacterMotor) @script AddComponentMenu ("Character/FPS Input Controller")
Добавлено (17.02.2012, 23:18) --------------------------------------------- А вот и на приседание... Просто вешаешь на камеру. И камеру в иерархии привязываешь.
Code
using UnityEngine; using System.Collections;
public class SidDown : MonoBehaviour { public Camera camere; float camPos; Vector3 yy; Vector3 ym;
// Use this for initialization void Start () { camPos = camere.transform.localPosition.y; yy.y = 0.8133545f; ym.y = -0.2154129f; } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.C)) { camere.transform.localPosition = ym; } if(Input.GetKeyUp(KeyCode.C)) { camere.transform.localPosition = yy; } } }
Добавлено (17.02.2012, 23:20) --------------------------------------------- Мдааа.... Разбаловал я тебя
Отчасти согласен, но всё же есть в нём что-то такое интересное, для саморазвития интереса, тем более в "подростково-юношеском" возрасте, всё подойдёт, всего хочется попробовать!
боевые искусства нужны для самообороны, а не для показухи!!!
Quote (anton-gar)
в "подростково-юношеском" возрасте, всё подойдёт, всего хочется попробовать!
Хочу записаться на секцию М1, брат ходит, говорит, что всё там "чётенько", а вообще спортом не увлекаться надо, а заниматься - и не так что раза 3-4 в неделю. Но больше всё же привлекают Боевые Искусства, хожу 5 лет на тейквандо, так как Боевые Искусства - это не только вид спорта, но и целая философия и т.д.
Тут речь идёт о другом! Рестлинг - это не спорт, а прыгающие друг на друга макаки!!!