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 /
  • Help Room /
avatar image
0
Question by Omerl_ahire · Oct 11, 2017 at 11:40 PM · instantiatetransformparticlesbulletspace

Particle rotation problems in Unity 2017.1.0f3

Hi everyone. After updating to Unity 2017.1.0f3 I have had a problem with the rotation of spawned particle systems, I am using gameObjects with particle systems and firing their rigidbodies as bullets in a game.

In the old version of unity the bullets inherit the value of the gun they are spawned from, but in updated Unity the bullets or at least their particle systems seem seem to be given the rotation of the world space. I have included the bullet firing code below.

 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 
 public class UniversalShooterScript : MonoBehaviour {
 
     //Weapon Values
     [SerializeField]
     Rigidbody projectile;
     public float speed;
     [SerializeField]
     float refireRate;
     bool canFire;
 
     //Effect
     [SerializeField]
     AudioClip[] fireSound;
     AudioSource source;
     [SerializeField] ParticleSystem onShot;
     public int emitAmount;
 
     //Energy Drain
     public PowerCapacity power;
     [SerializeField] float energyDrain;
    
     //Hangar Values
     public string weaponName;
     public string weaponType;
     public GameObject descText;
     GameObject inHangar;
 
     public void Start()
     {
         canFire = true;
         StartCoroutine(getPower());
         StartCoroutine(seeIfHangarTrue());
     }
     IEnumerator seeIfHangarTrue()
     {
         inHangar = GameObject.Find("HangarManager").gameObject;
         yield return new WaitForEndOfFrame();
         
         if (inHangar != null)
         {
             canFire = false;
         }
         else if(inHangar == null)
         {
             canFire = true;
         }
         yield return new WaitForSeconds(2f);
         StartCoroutine(seeIfHangarTrue());
     }
 
     IEnumerator getPower()
     {
         yield return new WaitForEndOfFrame();
         power = GameObject.FindWithTag("Player").GetComponent<PowerCapacity>();
     }
     void Update () {
         if (Input.GetMouseButton(1) && (canFire) && (power.currentCapacity >= energyDrain)) { 
         
             StartCoroutine("Shoot");
          power.currentCapacity -= energyDrain;   
         }    
     }
     IEnumerator Shoot() {
         {
             StartCoroutine(playParticle());
             Rigidbody instantiatedProjectile = Instantiate(projectile,transform.position,transform.rotation)
               as Rigidbody;
             
            instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0,0,speed));
             {
                 canFire = false;
                 yield return new WaitForSeconds(refireRate);
                 canFire = true;
             }
         }
     }
     IEnumerator playParticle ()
     {
         onShot.Emit(emitAmount);
         yield return new WaitForEndOfFrame();
     } 
 }
 

These gifs show the problem in the first gif bullets face forward from their firing point... Before. [img]https://i.imgur.com/k3Z2w7V.gif[/img] ...Where as in the second gif the bullets fly facing the same direction all the time even no matter the rotation of the gun. After. [img]https://i.imgur.com/aR7sw1s.gif[/img]

Any help would be greatly appreciated, thank you.

Comment
Add comment · Show 1
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 Omerl_ahire · Oct 12, 2017 at 04:08 AM 0
Share

Found a soloution. In the particle system in the inspector, there is a new section in the emissions panel with position, rotation and scale options. When I changed the scale option from 0 to 0.01 the problem was solved. I don't know how or why that fixed it but it did.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ifurkend · Oct 12, 2017 at 12:09 AM

Try changing the velocity mode or something like that in the main module which allows you switching between "rigidbody" and "transform".

Digression: 2017.1p3 particle system has a performance issue which is fixed from 2017.1p4.

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 Omerl_ahire · Oct 12, 2017 at 12:54 AM

@ifurkend Thanks for your reply. I have already tried the velocity mode and unfortunately there was no change, I also changed the render alignment to velocity but that made the bullets faded looking and didn't effect rotation.

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 Omerl_ahire · Oct 12, 2017 at 12:55 AM 0
Share

$$anonymous$$aybe I'll just update unity and hope that solves the problem.

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

152 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 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 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 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 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 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 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 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 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

Screen Space - Camera makes bullets fly in wrong directions 1 Answer

Missle/Bullet script. C# 2 Answers

Particles disappear when the parent rotates,My particles disappear when the parent rotates 0 Answers

Why isn't this code working? 1 Answer

Can't find a way to add particle effects to a collision 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