in my ice skating game i want the same effect as real ice skating game.how to get it while character runs through the ice.when the character run when he take a turn to left or right how to make the character to tilt toward one side due to the body mass he having like skating game. in skating game when player runs and turn immediately to left or right direction how to make him slightly tilt the his body towards the side he trued due to the mass of the body as in real ice skating game. how to tilt the character to one side when i use left and right arrow in my game.
2 Answers
2under the function for making your character turn add a fixed rotation on your local sideways axis. Although you will probably have to parent your character to an empty game object that's at the characters feet (and rotate that instead) to get the "lean" looking right.
var player1 : Animation;
var smooth = 2.0;
var tiltAngle = 30.0;
var tiltAngle1 = -30.0;
var a1 =0;
var a2 = 0;
function Update ()
{
if(a1==1)
{
var tiltAroundZ = Input.GetAxis("Horizontal") * tiltAngle1;
var target = Quaternion.Euler (0, 0, tiltAroundZ);
transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * smooth);
}
if(a2 ==1)
{
var tiltAroundZ1 = Input.GetAxis("Horizontal") * tiltAngle;
var target1 = Quaternion.Euler (0, 0, tiltAroundZ);
transform.rotation = Quaternion.Slerp(transform.rotation, target1, Time.deltaTime * smooth);
}
if(Input.GetAxis("Horizontal") < -.1 )
{
a1 = 1;
}
if(Input.GetAxis("Horizontal") < .1 )
{
a2 = 1;
}
if(Input.GetKey(KeyCode.UpArrow))
{
player1.Play("Take 001");
transform.Translate(0,0,0.1);
}
}
I do not understand the question enough to give any answer of which I feel the investment of time I put in it is worth it for the Q&A process. Please rephrase and elaborate
– anon90873654He wants 'auto banking'. Why so many down votes? We've seen broken English and bad spelling before. robermathew: do a search for bank or banking, check into some flight simulators that might do this for planes.
– DaveA