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 Demper · Jun 24, 2013 at 06:08 PM · spawnbulletshooter

Bullet spawning to low..

Hi I'm busy building an FPS part in my game but I'm unable to get the height of where the bullet is spawned right.. it keeps looking like I'm bowling or something...

I'm using the following code but I'm unable to find out why the bullets aren't spawning at the right place..

 function Start () {
 count = 0.5;
 speed = 40;
 }
 
 function Update () {
     count = count + Time.deltaTime;
     //print(count);
     if(count >= 0.5){
         if (Input.GetButton("Fire1")) {
  
                var clone : Rigidbody;
             clone = Instantiate(projectile, (transform.position + Vector3(0.3, 0, 0)), transform.rotation);
      
 
             clone.velocity = transform.TransformDirection (Vector3.right * speed);
         }
     count = 0;
     }
Comment
Add comment · Show 3
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 robertbu · Jun 26, 2013 at 01:44 AM 1
Share

I'm assu$$anonymous$$g the code above is attached to an empty game object. I'm guessing this is a 2D game with 'Y' being 'up'. I suggest you make a small visible game object (like a sphere set to a size of (0.1, 0.1, 0.1), make it a child of the empty game object with a position of (0,0,0) (i.e. at the same position). The code above should instantiate 0.3 to the right of the visible object. If that is not the case, take a look at your prefab and make sure any parent/child relationships have appropriate offsets.

avatar image realizz · Jun 26, 2013 at 02:13 AM 0
Share

1.maybe there is only one rigidbody in one gameobject,so you should create a gameobject and attach the clone rigidbody on it

2.maybe your rigidbody‘s mass is zero,so it can't move with velocity

3.you can see nothing without a meshrender and a mesh,so you need a gameobject as 1

avatar image Demper · Jun 26, 2013 at 02:50 PM 0
Share

I figured it out, since the person who created the level used an imported game object from maya the player was 1 higher on the X axes than normal therefore it looked like the bullets were spawning and moving at the characters feet. hence me changing the vector3 of the instantiate to 1,0,0 solved the issue, thanks for the quick replies though

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Demper · Jun 26, 2013 at 02:55 PM

problem has been solved :)

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

17 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

Related Questions

2D Shoot at Mouse Position; how to rotate towards the mouse? 1 Answer

Bullet Damage on different Limbs 1 Answer

Bullets spawn behind plane? 1 Answer

Shooting in direction of mouse cursor 2d 5 Answers

Bullets don't always appear at spawn point 0 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