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 Drew 1 · Feb 01, 2011 at 01:11 PM · javascripterrormissingmethodexception

shooting script error (java)

So i got this error:

MissingMethodException: Method not found: 'UnityEngine.Rigidbody.Addforce'.

Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()

Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()

Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target,

System.Type targetType, System.String name, System.Object[] args)

Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target,

System.String name, System.Object[] args)

Boo.Lang.Runtime.RuntimeServices+c_AnonStorey13.<>m_7 ()

Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get

(Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key,

Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)

Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String

cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args,

Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)

Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String

cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory

factory)

Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name,

System.Object[] args)

UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name,

System.Object[] args, System.Type scriptBaseType)

Move Around.Update () (at Assets/Move Around.js:19)

on this script:

var speed = 8.0; var rotateSpeed = 3.0; var bullitPrefab: Transform;

function Update ()

 {
     var controller : CharacterController = GetComponent(CharacterController);
     transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
     var forward = transform.TransformDirection(Vector3.forward);
     var curSpeed = speed * Input.GetAxis ("Vertical");
     controller.SimpleMove(forward * curSpeed);

     if (Input. GetButtonDown("Jump"))
     {
         var bullit = Instantiate(bullitPrefab,
                                         GameObject.Find("Fire Spawn").transform.position,
                                         Quaternion.identity);
         bullit.rigidbody.Addforce(transform.forward * 2000);

     }


 }

@script RequireComponent(CharacterController)

i don't know java, im just following a tutorial. heres the link to it if you need it: clicky

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Borgo · Feb 01, 2011 at 01:24 PM

Hi!!

its not Java, its Javascript (its very diferent).

Try to cut out the "rigidbody" in this line:

bullit.rigidbody.Addforce(transform.forward * 2000);

In the docs:

var clone : Rigidbody;
clone = Instantiate(projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection (Vector3.forward * 10);

In the doc, the instantiate return the Rigidbody, so, I guess it's not necessary to wite ".rigidbody"
I can't test now, so, try this.

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

Answer by Mike 3 · Feb 01, 2011 at 01:18 PM

AddForce, not Addforce

One small tip though, change:

var bullit = Instantiate(bullitPrefab ...

to

var bullit : Transform = Instantiate(bullitPrefab ...

and you will get compiler errors from the line below it, showing you why it's not working at runtime

Comment
Add comment · Show 1 · 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 Drew 1 · Feb 01, 2011 at 01:21 PM 0
Share

yay thank you so much! i really should learn java for unity. but i also want to learn python.

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

No one has followed this question yet.

Related Questions

Exception error 1 Answer

Trouble converting player controller from JS to C# 1 Answer

Change gameobject sprite with button 1 Answer

Error Message Coordinates 1 Answer

Javascript Snakegame Error Cannot convert ....Gameobject to .....Transform 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