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 Digital-Phantom · Feb 22, 2015 at 03:32 PM · vector3velocityontriggerenterjumpingreceiver

Error when trying to implement JumpPad/GravityPad type effect on CharacterController (Solved)

I'm trying to create a jumpPad/launchPad effect in my game. Nothing fancy, just a simple boost upwards when the player runs across the pad.

After searching round the forums I came across this script, which seemed to be exactly what I was looking for -

 #pragma strict
  
  
  var moveVelocity : Vector3 = Vector3.zero;
  
  private var thePlayerMotor : CharacterMotor;
  
  
  function Start()
  {
      thePlayerMotor = GetComponent(CharacterMotor);
  }
  
  
  function OnTriggerEnter(ThePad : Collider)
  {
      if (ThePad.gameObject.tag == "JumpPad")
      {
          moveVelocity = Vector3(0,50,0);
          thePlayerMotor.SetVelocity(moveVelocity);
      }
  }
 

But I get this error when the pad/trigger is activated -

SendMessage OnExternalVelocity has no receiver! UnityEngine.Component:SendMessage(String) CharacterMotor:SetVelocity(Vector3) (at Assets/Standard Assets/Character Controllers/Sources/Scripts/CharacterMotor.js:582) JumpPadLaunch:OnTriggerEnter(Collider) (at Assets/JumpPadLaunch.js:20)

Any help would be appreciated

???

Comment
Add comment · Show 1
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 Digital-Phantom · Feb 22, 2015 at 06:11 PM 0
Share

anybody ???

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by gkepets · Feb 22, 2015 at 10:19 PM

i used this script:

 #pragma strict
         var strength : int = 10; 
 
         var jumppadsound : AudioClip; 
 
         // 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);
 

make sure the character is tagged "Player"

Comment
Add comment · Show 4 · 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 Digital-Phantom · Feb 23, 2015 at 06:12 AM 0
Share

No good I'm afraid. I've assumed you meant swap the script from the Player Controller to the JumpPad object. I tried your script on the jump pad and the player/controller but got the same error message both times-

Send$$anonymous$$essage OnExternalVelocity has no receiver! UnityEngine.Component:Send$$anonymous$$essage(String) Character$$anonymous$$otor:SetVelocity(Vector3) (at Assets/Standard Assets/Character Controllers/Sources/Scripts/Character$$anonymous$$otor.js:582) JumpPadLaunch:OnTriggerEnter(Collider) (at Assets/JumpPadLaunch.js:13)

code from Character$$anonymous$$otor script thet the error refers to -

 function SetVelocity (velocity : Vector3)
 {
     grounded = false;
     movement.velocity = velocity;
     movement.frameVelocity = Vector3.zero;
     Send$$anonymous$$essage("OnExternalVelocity"); //THIS LINE ! ! !
 }
 

???

Are you using the Unity FPS Controller ? If so, did you change anything on the Character$$anonymous$$otor script ?

avatar image Digital-Phantom · Feb 23, 2015 at 09:52 AM 0
Share

If I go to the part of the script the error refers to and comment out that particular line -

 function SetVelocity (velocity : Vector3)
  {
      grounded = false;
      movement.velocity = velocity;
 5.     movement.frameVelocity = Vector3.zero;
      //Send$$anonymous$$essage("OnExternalVelocity"); //THIS LINE NOW CO$$anonymous$$$$anonymous$$ENTED OUT ! ! !
  }
 

It now works perfectly. However (throwing this question out to anybody who may know)

Is commenting out this line going to have an adverse effect on anything else? I've played through my various scenes and it doesn't seem to be affecting anything. So... am I going to be ok without this line of code (what exactly did it do anyway?)

???

avatar image gkepets · Feb 23, 2015 at 11:31 AM 1
Share

I used the standard First person controller, and i dont know much about the fps controller.

avatar image Digital-Phantom · Feb 23, 2015 at 03:28 PM 0
Share

O$$anonymous$$ thanks. Like I said it all seems to be working fine, just waiting to see if commenting out that single line of code throws up any issues later on.

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

21 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 avatar image avatar image

Related Questions

Vector3 Issues - Not Able To Solve Constructor issue 1 Answer

How to stop player velocity completely 1 Answer

Rigidbody flies up instead of just jumping. 1 Answer

Animation or smooth teleportation 0 Answers

Converting vector3 velocity to an angel 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