• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • 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

avatar image
0
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
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bodec · Jun 25, 2012 at 04:12 PM 0
Share

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.

avatar image Berenger · Jun 25, 2012 at 04:25 PM 0
Share

I've created a pastebin for the final script.

avatar image skatiskate · Jun 26, 2012 at 11:56 AM 0
Share

I contacted the creators and we fixed the problem :)

0 Replies

  • Sort: 

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Skateboard tilting problem 1 Answer

how can I make a skater follow a ramps rotation 0 Answers

Problems entering in Fly Mode 1 Answer

ObjectSpawner 1 Answer

Move Object a direction with one button and move the object back with the same button? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges