where can i found First Person Controller ? and in my unity iphone why i dont have 'Standard Assets'' or ''Pro Standard Assets'' ?
Look in /Applications/Unity/Standard Packages/Standard Assets.unitypackage or where you saved it. It wont have any iphone control support yet, but that should not be too hard to implement.
/Applications/Unity/Standard Packages/Standard Assets.unitypackage this is not for iphone ... it s for unity indie ...or function in iphone ?
Im starting to go through and convert the FPS scripts for the iphone.... here is mouse look... Code (csharp): using UnityEngine; using System.Collections; [AddComponentMenu("iPhone/Camera-Control/Mouse Look")] public class MouseLook : MonoBehaviour { public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 } public RotationAxes axes = RotationAxes.MouseXAndY; public float sensitivityX = 15F; public float sensitivityY = 15F; public float minimumX = -360F; public float maximumX = 360F; public float minimumY = -60F; public float maximumY = 60F; float rotationX = 0F; float rotationY = 0F; Quaternion originalRotation; void Update () { if (axes == RotationAxes.MouseXAndY) { // Read the mouse input axis rotationX += iPhoneInput.acceleration.x * sensitivityX; rotationY += iPhoneInput.acceleration.y * sensitivityY; rotationX = ClampAngle (rotationX, minimumX, maximumX); rotationY = ClampAngle (rotationY, minimumY, maximumY); Quaternion xQuaternion = Quaternion.AngleAxis (rotationX, Vector3.up); Quaternion yQuaternion = Quaternion.AngleAxis (rotationY, Vector3.left); transform.localRotation = originalRotation * xQuaternion * yQuaternion; } else if (axes == RotationAxes.MouseX) { rotationX += iPhoneInput.acceleration.x * sensitivityX; rotationX = ClampAngle (rotationX, minimumX, maximumX); Quaternion xQuaternion = Quaternion.AngleAxis (rotationX, Vector3.up); transform.localRotation = originalRotation * xQuaternion; } else { rotationY += iPhoneInput.acceleration.y * sensitivityY; rotationY = ClampAngle (rotationY, minimumY, maximumY); Quaternion yQuaternion = Quaternion.AngleAxis (rotationY, Vector3.left); transform.localRotation = originalRotation * yQuaternion; } } void Start () { // Make the rigid body not change rotation if (rigidbody) rigidbody.freezeRotation = true; originalRotation = transform.localRotation; } public static float ClampAngle (float angle, float min, float max) { if (angle < -360F) angle += 360F; if (angle > 360F) angle -= 360F; return Mathf.Clamp (angle, min, max); } } Its a c# script
and here is the FPS walker Code (csharp): var speed = 6.0; var jumpSpeed = 8.0; var gravity = 20.0; private var moveDirection = Vector3.zero; private var grounded : boolean = false; function FixedUpdate() { if (grounded) { // We are grounded, so recalculate movedirection directly from axes moveDirection = new Vector3 (iPhoneInput.acceleration.y, 0,iPhoneInput.acceleration.x); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; if (Input.GetButton ("Jump")) { moveDirection.y = jumpSpeed; } } // Apply gravity moveDirection.y -= gravity * Time.deltaTime; // Move the controller var controller : CharacterController = GetComponent(CharacterController); var flags = controller.Move(moveDirection * Time.deltaTime); grounded = (flags CollisionFlags.CollidedBelow) != 0; } @script RequireComponent(CharacterController) you may want to tweak it as having both scripts mapped to the accelerometer will mess it up.
It was really simple.. all i did was replace the previous input with Code (csharp): iPhoneInput.acceleration.x or y No problem.. glad to help
What's happening? There is no way anyone can solve your problem with just 'dont functions'. Try being more specific, like saying what error you are getting or what is happening.
ok sorry in this code the first person move left and right ... i wont to rotate it . Code (csharp): var speed = 6.0; var jumpSpeed = 8.0; var gravity = 20.0; private var moveDirection = Vector3.zero; private var grounded : boolean = false; function FixedUpdate() { if (grounded) { // We are grounded, so recalculate movedirection directly from axes moveDirection = new Vector3 (iPhoneInput.acceleration.y, 0,iPhoneInput.acceleration.x); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; if (Input.GetButton ("Jump")) { moveDirection.y = jumpSpeed; } } // Apply gravity moveDirection.y -= gravity * Time.deltaTime; // Move the controller var controller : CharacterController = GetComponent(CharacterController); var flags = controller.Move(moveDirection * Time.deltaTime); grounded = (flags CollisionFlags.CollidedBelow) != 0; } @script RequireComponent(CharacterController)
ok now function all ... thanks thanks thanks :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: :wink: