Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 28, 2011 at 08:04 PM by Bob5602 for the following reason:

Figured it out! Bullets collision detection was large enough they collided between barrels and died on spawn.

avatar image
0
Question by Bob5602 · May 28, 2011 at 07:32 PM · instantiatecubeplaneturretammo

instantiate works on one but not other object

Hello all!

I'll try to be brief. I have a turret, consisting of a cockpit (with a "fire control" script on it), and two barrels with "Shooter" objects. When the turret sees a target, fire control will send a "fire" message to each shooter, firing a bullet. Relevant part of firing script :

             var fireShot : FireShot = turret.GetComponent(FireShot);
             projectileSpeed = fireShot.shotSpeed;
             fireShot.fire();
             Debug.Log("Fire a bullet?");

Now, here is the actual firing script in the shooter :

 var ammo : GameObject;
 var strength : int = 10;
 var shotSpeed : float;
 shotSpeed = strength * 10;
 
 function fire(){
 fwd = transform.forward;
 shot = Instantiate(ammo, transform.position , transform.rotation);
 Debug.Log("Just'made' a shot");
 shot.rigidbody.AddForce(fwd * 500 * strength);
 }


My issue is I have a new bullet type that doesn't work. I had used cube shaped bullets with a rigidbody and a few scripts on it, collider, etc. I also made a second, newer "bullet" which was a plane with a bullet texture, with the same scripts and rigidbody, and a sphere collider instead of a mesh one.

I wanted to change out the "ammo" objects on my turrets, and here were the results :

If BOTH shooters are firing cubes, they both fire. If one shooter is firing cubes and one is firing plane bullets, they both fire. If both shooters are firing plane bullets, they do not fire.

Please help!

Cheers, Marcin

Comment
Add comment · Show 5
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 Bob5602 · May 28, 2011 at 07:34 PM 0
Share

And I should add, that both debug.log statements are recorded no matter the way I set up bullets between shooters.

avatar image aldonaletto · May 28, 2011 at 07:50 PM 1
Share

What do you mean by "they do not fire"? You can't see the bullets, or they really are not fired at all? Put a debug.log in the bullet script if you are not sure - maybe they're being fired but are not visible

avatar image Bob5602 · May 28, 2011 at 07:55 PM 0
Share

Good thinking. I was assu$$anonymous$$g they weren't being fired at all since they did not show up in the hierarchy. I put a debug in the bullets awake function, and they do appear to be actually spawning.

avatar image aldonaletto · May 28, 2011 at 08:03 PM 0
Share

Do your turrets fire multiple shots at once? I mean, are there many bullet instances alive at the same time?

avatar image Bob5602 · May 28, 2011 at 08:05 PM 0
Share

It is two bullets, one for each barrel of the turret, that fire simultaneously.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Instantiating prefabs, when there is nothing 2 Answers

Adding Imperfections? 1 Answer

How to find and remove the last child of parent? 1 Answer

Checking if object intersects? 1 Answer

Change the direction of the Cube instantiate 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