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 PlatinumSkink · May 12, 2011 at 07:52 AM · instantiatemoveprojectileunresponsive

My instantiated projecttile refuses to move

var Missile : Rigidbody;
var localOffput : Vector3 = new Vector3(200, 200, 200);
var SpawnPlace : Vector3 = new Vector3(0, 0, 0);
var startingSpeed : int = 30;
function Update () {
    SpawnPlace = new Vector3(transform.position.x, transform.position.y, transform.position.z);
}
function Blast () {
    Debug.Log("I'M FIIRIN MY MISSILWE!!!");
    var newMissile : Rigidbody;
    newMissile = Instantiate (Missile, Vector3(transform.position.x, transform.position.y, transform.position.z), gameObject.transform.rotation);
    //PlayerSpeed = transform.Find("Capsule");
    //newMissile.rigidbody.velocity = GameObject.Find("Wings").rigidbody.velocity;
    //newMissile.angularVelocity = GameObject.Find("Wings").rigidbody.angularVelocity;
    //newMissile.velocity += transform.TransformDirection(Vector3.forward * startingSpeed);
    newMissile.rigidbody.AddForce(transform.forward * startingSpeed);
    //newMissile.velocity += transform.TransformDirection(Vector3 (0, 0, startingSpeed));
    //newMissile.velocity = new Vector3(300, 300, 300);
    Physics.IgnoreCollision(newMissile.collider, transform.root.collider);
}

OK, I have no idea why my instantiated missile refuses to move, no matter what kind of code I put on it. In fact, it does not seem to at all be affected by anything I code after I instantiate it. What could cause such a behaviour? What have I forgot to do?

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 PlatinumSkink · May 12, 2011 at 08:04 AM 0
Share

... Why cannot I modify my question to correct the word "projecttile"..? Or is it simply that I cannot detect the means of doing so..?

avatar image PlatinumSkink · May 12, 2011 at 08:13 AM 0
Share

Swii... It does not even ignore collisions, despite that last row of code...

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by loopyllama · May 12, 2011 at 08:30 AM

you are adding a force on a single frame and I bet it is working. It is just a very small force. Try making your startingSpeed number very large. Perhaps you should control the movement by adding a small amount to the position each frame rather than use the physics system.

Comment
Add comment · Show 2 · 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 Antony-Blackett · May 12, 2011 at 08:33 AM 0
Share

I would use the physics system myself.

avatar image loopyllama · May 12, 2011 at 08:49 AM 0
Share

using the physics system to move a rocket is like opening a bag of chips with a sledgehammer. yes, it will indeed work.

avatar image
0

Answer by Antony-Blackett · May 12, 2011 at 08:35 AM

Try changing the AddForce line to this.

newMissile.rigidbody.AddForce(transform.forward * startingSpeed, ForceMode.VelocityChange );
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

No one has followed this question yet.

Related Questions

Make multiple Projectiles move at the same Time... 0 Answers

Multiplayer Projectile Instantiation 1 Answer

Scripts not on instantiated GameObjects? 1 Answer

Rotating and firing projectiles 1 Answer

Slow automatic shooting script? 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