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 /
This question was closed Oct 21, 2013 at 04:08 PM by robertbu for the following reason:

Other

avatar image
0
Question by DMCH · Oct 21, 2013 at 03:03 PM · spawnbulletdelayvisible

Bullets don't always appear at spawn point

Hi,

Thanks for reading. Having some difficulty with bullets in my game. Sometimes, when they are first visible, it is some distance from their spawn point. Bullets have a rigidbody and are moved with this code (in Update method):

 transform.Translate(0, 0, bulletSpeed * Time.deltaTime);
 transform.position = new Vector3(transform.position.x, 0 , transform.position.z);

Bullets ignore collisions on the player layer. If you need anymore info, let me know.

Update 1: This problem doesn't seem to occur in the build, only when the game is played within Unity.

Tried so far:

  • There were quite a lot of fields to set (various bullet stats). Commented out the code for setting these, incase it was causing a delay. Also got rid of trail renderer

  • Checked for any collisions that might be happening as the bullet is spawned. Doesn't seem to be anything.

  • Moved the spawn points to see if that changed anything

Open to suggestions on fixing this. Worse case scenario, I can use the muzzle flare graphic to disguise the problem, but I'm a little concerned this may be the symptom of another problem.

Comment
Add comment · Show 7
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 · Oct 21, 2013 at 03:45 PM 1
Share

Any chance one bullet is colliding with another at the spawn point?

avatar image DMCH · Oct 21, 2013 at 03:49 PM 0
Share

There's a fairly decent $$anonymous$$imum interval between bullets, so that's unlikely. I found that it only happens when the game is played in the editor, not in the build, so I guess it's not really a problem anymore.

I'm going to close off the question, but would you know why different things are happening in the standalone build and the editor? Is there much of a processing overhead when playing the game in the editor?

avatar image Owen-Reynolds · Oct 21, 2013 at 04:04 PM 1
Share

A rigidbody using Translate to move? Is the rigidbody always set kinematic (so, only used for collisions?)

Running in the editor has a few rare glitches that won't be there for real, and can sometimes have rare stutters while it manages editor data, but you'd be seeing it for everything -- not just the bullets.

avatar image meat5000 ♦ · Oct 21, 2013 at 04:10 PM 1
Share
   transform.Translate(0, 0, bulletSpeed * Time.deltaTime);
     transform.position = new Vector3(transform.position.x, 0 , transform.position.z);

If the code is in Update then you are applying 2 different movement methods and neither of them will work well with physics. You are teleporting twice a frame. Once forward, once on the spot but at world y = 0.

If they have rigidbody use AddForce or $$anonymous$$ovePosition. There are verious raycast methods, too.

avatar image meat5000 ♦ · Oct 21, 2013 at 04:28 PM 1
Share

If they have rigidbody use AddForce or $$anonymous$$ovePosition.

If for some reason you need to zero world y axis, try to do it once at the start (on instantiate?) and then have just one movement call routine. Your bullet is kinda flickering through space.

Show more comments

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

16 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

Related Questions

Shoot Bullet Delay Enemy 0 Answers

Classic Fireball Shooting Up Obstacle 1 Answer

Bullet spawning to low.. 0 Answers

Problem with enemy shooting 4 Answers

Spawn an object? 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