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 /
avatar image
0
Question by mrTallents · Feb 01, 2012 at 01:36 PM · fpsjumpingfpstutorialfpswalkerfps-controller

Gravity Lift/Jump Pad for FPS game

I have read the Lerpz documentation on creating the jump pad however i want to do this in my FPS game. Here is my script

//----jumppad.js----

var jumpAngle:Vector3; var jumpMagnitude:float=1.0;

function OnControllerColliderHit (entity)

{

      //Make sure the triggering entity has a rigidbody before we try to access it!

      if(entity.gameObject.tag == "player")
          {
       print("hit the grav pad");
       //Apply the force
       entity.rigidbody.AddForce(jumpAngle*jumpMagnitude);
  }

}

This script needs a rigid body, which the fps controller doesnt have. The lerpz script references the third person controller but im not sure how to adapt that to the FPS.

If anyone can help i would be massively grateful

Kind Regards

Nick

Comment
Add comment · Show 2
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 ByteSheep · Feb 02, 2012 at 07:58 AM 0
Share

Don't know if this will interfere with anything but why not try just adding a rigidbody component via Component>Physics>Rigidbody ? You might want to uncheck the useGravity option to avoid 'double' gravity.

avatar image wenhua · Feb 02, 2012 at 08:46 AM 0
Share

hi merry_christmas, can you help take a look on my question(Help in Calculate Point to Point distance)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by jewetnit · May 17, 2013 at 03:34 PM

This is what I used for a jumppad in my game, it's pretty easy Create a cube gameObject and add this script to it. Make sure the box collider Is Trigger is checked. If you want to play a sound when a player uses the jumppad be sure to add an audiosource to the jumppad too. JS:

 #pragma strict
 var strength : int = 10; // Strenght, how high will the jumppad make the player jump
 var jumppadsound : AudioClip; // Sound played when a player uses the jump pad
 
 // make sure to check the Is Trigger checkbox in the Box/mesh/whatever collider
 function OnTriggerEnter(col : Collider){
 // Make sure the "Player" tag is set on the player
     if(col.CompareTag("Player")){
         col.gameObject.GetComponent(CharacterMotor).SetVelocity(Vector3.up * strength);
         audio.PlayOneShot(jumppadsound);
     }
 }
 @script RequireComponent(AudioSource);

Without sound:

   #pragma strict
     var strength : int = 10; // Strenght, how high will the jumppad make the player jump
  
     // make sure to check the Is Trigger checkbox in the Box/mesh/whatever collider
     function OnTriggerEnter(col : Collider){
     // Make sure the "Player" tag is set on the player
         if(col.CompareTag("Player")){
             col.gameObject.GetComponent(CharacterMotor).SetVelocity(Vector3.up * strength);
   
         }
     }
Comment
Add comment · 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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

8 People are following this question.

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

Related Questions

I want to modify the player not to slide.,I want to modify the player not to slide 0 Answers

DastardlyBanana(moving while jumping. 2 Answers

CursorLockMode.Locked puts cursor above actual center 0 Answers

FPS Tutorial part 2 - please help 1 Answer

Player Falls Much Slower While Moving 2 Answers


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