Hello All,
I was able to find this script on these forums (thanks guys) for FPSwalker with tilting the iphone, and when I tilt forwards or backwards, everything is fine, but when I tilt to the right, I go to the left and if I tilt to the right I go to the left.
The script is below:
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)
Now, I do have a second script that is allowing my project to be landscaped, and it’s listed below. Are these 2 scripts conflicting with each other?
The landscape script is listed below: