- Home /
This question was
closed Jun 26, 2012 at 02:04 PM by
Berenger for the following reason:
The question is answered, right answer was accepted
Question by
skatiskate · Jun 25, 2012 at 12:41 PM ·
flyairrampskateboard
how to make a skater fly of a ramp to the air problem
I was watching design3's skater tutorial but they didn't show how to make the skater fly of a ramp in their videos, but it was in the project file.
Here's the code that I tried to copy from the project files but it doesn't work. When I ride on a half pipe the skater turns 180 degrees, but the skater doesn't fly up in the air. this is my script:
if ( vertical )
{
moveDirection = Vector3.up * speed;
speed -= Time.deltaTime * Physics.gravity.magnitude;
}
if (vertical)
{
var toRotate = horizontal * rotateSpeed * inAirRotateScale * Time.deltaTime;
vertRotation += Mathf.Abs(toRotate);
skater.Rotate(0, toRotate, 0);
}
else
trans.Rotate(0, horizontal * rotateSpeed * Time.deltaTime, 0);
if ( vertical && character.isGrounded )
{
vertical = false;
trans.forward = -trans.forward;
speed *= -1;
var skaterRot = Vector3.Dot(trans.forward, skater.forward);
if (Mathf.Abs(skaterRot) < oneEightyThreshold)
Fall();
else if (vertRotation > 180.0 * oneEightyThreshold)
{
var multiplier = Mathf.Round(vertRotation / 180.0);
// Player successfully rotated around
//addPoints = oneEightyPoints * multiplier;
//trickPoints.Add(addPoints);
//trickLabel.Add(String.Format("{0}! +{1}", 180 * multiplier, addPoints));
}
skater.forward = trans.forward;
}
if (Vector3.Dot(Vector3.up, targetForward) >= 0.6
&& speed > maxSpeed * 0.6
&& !vertical)
{
vertical = true;
vertRotation = 0;
//var addPoints = verticalPoints;
//trickPoints.Add(addPoints);
//trickLabel.Add("VERT! +" + addPoints);
//trickAudio.PlayOneShot(ollieSound);
var vertOriginalRot = skater.rotation;
}
and here's the final script from the finished project. sorry I know it's kinda long xD
Comment
You need to format all the code so we may be able to read it. and you should try and contact the creator of the script to ask them as they know where and why you are turning a 180 at the top.