Hey Guys I am an Artist and need some help with my character controller...
I do have working character controller that I really like but it uses keyboard input and I need this to be rewritten so it works with
(tap to move) input in order to be used on IOS Device...
here is the Original Script that moves the spaceship with keyboard input and makes it tilt towards the left or right depending on the direction it is moving to:
using UnityEngine;
using [login to view URL];
[[login to view URL]]
public class Boundary
{
public float xMin, xMax, zMin, zMax;
}
public class PlayerController : MonoBehaviour
{
public float speed;
public float tilt;
public Boundary boundary;
void FixedUpdate ()
{
float moveHorizontal = [login to view URL] ("Horizontal");
float moveVertical = [login to view URL] ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
[login to view URL] = movement * speed;
[login to view URL] = new Vector3
(
[login to view URL] (rigidbody.position.x, [login to view URL], [login to view URL]),
0.0f,
[login to view URL] (rigidbody.position.z, [login to view URL], [login to view URL])
);
[login to view URL] = [login to view URL] (0.0f, 0.0f, rigidbody.velocity.x * -tilt);
}
}
//- this is a classic style arcade top down shooter
//- the new controller should have ship moving towards the tapped/clicked point ... but not using virtual buttons or joystick
// you tap somewhere on the screen, and spaceship moves towards that point
// -ship can move left/right , up /down and of course diagonally
//- Ship does not look at (rotate towards) destination it is moving to, only tilts (leans towards left or right) depending on direction
// - Ship has to tilt toward left if moving towards left and tilt right if moving towards right
// Ship does not Tilt if moving forward and backwards (on Z axes) if represented by clock that would be 12 o' clock- forward, and 6 o' clock -backwards
// ship has Maximum tilt when moving left or right, on x axes, (9 o' clock -left, or 3 o' clock- right) amount of tilt falls of as angle of x and y is reduced
// for an instance if you click somewhere on the screen like (11 o' clock) that would be minimum tilt, and 12 o' clock which is strait forward no tilt at all
// same if moving backward, minimum tilt would be something like 7 and 5 o'clock while 6 o'clock no tilt, tilt increase as we move towards 9 or 3 o clock
I hope this make sense , please let me know if you require any additional information's...
even though original code uses physic I am not bothered if you don't use it ...
whatever works best and less demanding on memory ...
Thanks
Beri
p.s I include sample scene of original movement to give you an idea what kind of movement I am looking for
Hi,
I have over two years experience with Unity3D and I can say that I'm quite expert in Unity3D right now.
I can help you with this script.
And don't have no questions, I understood completely.
Best Regards!
Nechifor Marian