Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 May 20, 2013 at 04:52 AM by AlucardJay for the following reason:

Question is off-topic or not relevant

avatar image
0
Question by slidecoast · May 13, 2013 at 06:53 AM · movementcollidercharacterjumpfly

Making character to fly

I have a little problem with my character to fly. I am looking for a way to have my character to fly when I hold down a button. I have the character movement already but now, i am look for a way to have my character to fly. I looked for answers on this site relating to flying but they did not seem to work on my project. Could someone please show some sample code to make my character fly?

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 Shankar · May 13, 2013 at 07:24 AM 0
Share

Hi Slidecoast,

By using spacebar we will make jump. I think ur missing some clarity. please update ur question.

http://www.packtpub.com/article/unity3-building-rocket-launcher this link is may be help for u.

avatar image ahaykal · May 13, 2013 at 07:59 AM 0
Share

Well the only way I can think of is add a force in the y direction whenever u press this key.. Try it and show us what you have done so far so we could help you more.

avatar image AlucardJay · May 20, 2013 at 04:52 AM 0
Share

Sorry, but your question is not suitable for Unity Answers, and this is not the place to ask for code. Please use the Unity Forum for discussions such as "How to ...". Unity Answers is here to help you solve any specific problems you have.

  • http://forum.unity3d.com/

  • http://answers.unity3d.com/page/newuser.html

  • http://video.unity3d.com/video/7720450/tutorials-using-unity-answers

1 Reply

  • Sort: 
avatar image
3
Best Answer

Answer by aldonaletto · May 13, 2013 at 09:25 AM

Well, this depends on your movement code. If it's a custom script, edit your answer and post it - it's impossible to help you without knowing your code. If you're using the First Person Controller, however, you must use specific functions available in the complicated CharacterMotor.js script. A simple way to implement a kind of jet-pack feature is to add the script below to the First Person Controller:

 var cMotor: CharacterMotor; // reference to the CharacterMotor script
 
 function Start(){ // get the CharacterMotor script at Start:
     cMotor = GetComponent(CharacterMotor);
 }
 
 function Update(){ // move player upwards while F is pressed
     if (Input.GetKey("f")){
         cMotor.SetVelocity(Vector3.up*1.5);
     }
 }

 // This do-nothing function is included just to avoid error messages
 // because SetVelocity tries to call it

 function OnExternalVelocity(){
 }

Comment
Add comment · Show 3 · Share
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 slidecoast · May 19, 2013 at 07:34 AM 0
Share

Do you know any code that can make a character to glide?

avatar image fafase · May 19, 2013 at 07:51 AM 0
Share

To glide would be like flying but without thrust I would think.

So the logic remains the same except that you only gain speed when going down.

It may a little tricky since you would have to check angle between the player and the Vector3.up to see that when the dot is 0 the character is gliding but when the dot product is negative degrees then you gain speed and this gain increased as your dot gets closer to -1 which means you are head down.

If the dot is positive, then you are going up but you are also losing speed.

That is what I would start with. But I have never done that nor have I ever glided.

avatar image slidecoast · May 20, 2013 at 04:50 AM 0
Share

How can I detect when my character is jumping or falling? If I can detect jump collision, then I can try to make my character to glide. Could you show some sample code in relation to how to make the character to glide? or to make a character slow

Follow this Question

Answers Answers and Comments

19 People are following this question.

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

Related Questions

Making a character to glide 2 Answers

How to prevent rigidbody with capsule collider from walking off the edge of cube mesh if button held down? 1 Answer

When I look down and move forward, I fly upwards 0 Answers

Need Scripts for wall forward to behind and climb 0 Answers

isGrounded is always false, even with gravity, how do you fix that? 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