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 pstarr · Dec 26, 2012 at 08:53 AM · errorphysicsrigidbodybugitween

Strange physics, rigidbody, iTween activity

Hey guys, I'm having some strange behaviors with both my projectiles, and my enemies. I've been trying to figure this out in the back of my mind, while coding the other aspects, but it's still eluding me.

Strange behaviors are: - Projectiles: sometimes fire straight, and sometimes fire at an angle or slanted, or corkscrew. - Enemies getting knocked back using iTween will rotate them in crazy ways, never knocking them directly back, but more knocking them down through the floor usually, etc, even with no rotation code written for them. (I've used this code for other games and it's worked fine with no bugs) - Enemies when spawning, sometimes spawn correctly with the particle effect and work fine (maybe 80% of the time), and other times, they rocket straight into the air at high speed and never come down.

The strange thing is, I've done games before, I've used this same code previously and it's worked perfectly, this time, the same code has erratic behaviors and renders the game buggy enough to be a serious issue.

If you've encountered this before, I'd love some input. Any help would be greatly appreciated.

You can see in the pic attached, that I'm standing in one spot, and the projectiles are going in strange directions.

alt text

spyfall12_17.jpg (185.4 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Fattie · Dec 26, 2012 at 08:59 AM

"Strange behaviors are: - Projectiles: sometimes fire straight, and sometimes fire at an angle or slanted, or corkscrew"

Almost certainly, one problem could be:

You need to extensively use the "physics layers" system in Unity.

http://docs.unity3d.com/Documentation/Components/LayerBasedCollision.html

When hero H fires bullet B, the bullet B will interact with hero H as it begins its journey!

The solution to this issue in game engines is physics layers. In practice, you can't do anything at all in Unity physics without using the layers system.

it is very likely you'd have to totally redo it using layers - before looking for any other problem. Fortunately it's easy to do so.

BTW "spawn enemies" .. if you mean using Instantiate(), generally you don't instantiate anything during gameplay in a vid game. One uses a pool .. here's a long discussion!

http://answers.unity3d.com/questions/321762/how-to-assign-variable-to-a-prefabs-child.html

So physics laters, hope it helps in some way cheers

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 pstarr · Dec 27, 2012 at 09:06 PM 0
Share

Actually, this wound up being the reason for the projectiles malfunctioning. It wasn't colliding with the enemies, or other objects, it was colliding with invisible triggers used for AI. I'm sure could very well be the same case with the enemies, and I guess I'll know very soon. :) Thanks for the input, much appreciated for you to dedicate your time and knowledge to the community. :)

avatar image pstarr · Jan 04, 2013 at 02:11 AM 0
Share

For future reference, the physics layers fixed the projectile bug, the rocketing enemies, was caused by the enemy prefabs having both the CharacterController and RigidBody on them. Removing the rigidbody fixed the issue, as well as fixing another issue with jumpy animations.

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

10 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

Related Questions

Kinematic rigidbody with interpolation issue 0 Answers

Unity Script causing crash 1 Answer

How do I get the 2.5d platformer's rigidbody physics to follow a path? 2 Answers

No bounce after rigidbody collision 2 Answers

Error: NpRigidDynamic::isSleeping: Body must be in a scene. 1 Answer


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