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 asylum101 · Oct 22, 2013 at 08:23 PM · javascriptcolliderplayerobject

Object won't collide with Player unless Player is moving

So yeah. Basically I have a simple Galaga/Space Invaders type game, and I have a power up that drops randomly from ships and flies towards the player at the same speed as the enemy ships. If the player moves to get it, the player usually will obtain the power up. However if the player ISN'T moving whatsoever, the powerup will pass right through. Both the player and the object are using simple box colliders, and are simply boxes with textures painted on.

I'm a beginner in both Unity and Javascript, any tips/help would be appreciated.

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 Matthew012 · Oct 22, 2013 at 08:29 PM 0
Share

Post your code so we can see what the issue with the code. Other wise we got no clue how you're coding it to work therefore we don't know where to start.

avatar image rednax20 · Oct 22, 2013 at 09:05 PM 0
Share

I'm pretty sure the character has to be moving to collide/trigger and object. I have often times wondered about this but it hasn't been a problem for me. I'm sure someone will give you an answer.

Down to business. Your power ups have rigidbodies right? if not you definitely want to add some (add some to your character too if it doesn't have one.) you need rigidbodies to activate collisions.

again i don't know what causes this problem to happen but, i have observed it.

another useful thing to know would be : are you using transforms to move your power up / character or force.

hope this helps i hope you get your answer (for i too am curious about this)

avatar image Matthew012 · Oct 22, 2013 at 09:11 PM 0
Share

rednax20 comment just made me remember, ins$$anonymous$$d of using collide, use rayCast and see if it hit the player and if it does give the power up set the rayCast distance to 0.1 o the player has to be right on it or infront of it. This should solve your issue, make sure to put this script on the powerup and to put it in the update to see if it hit anything on each frame.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by asylum101 · Oct 23, 2013 at 12:24 AM

I feel like an idiot, I forgot to put rigid bodies on my power up. /facepalm. I put them in and it looks like its working just fine.

It's weird though, like I said, the power ups WERE working, not exactly as I had intended though. I could pick up the powerup so long as I was moving, once I sit still.. nothing.

I'm using transforms to move my stuff, is force better? What are the advantages of one or the other?

Raycast- man I still need to learn how to do that. I was trying to make a simple platformer engine a while back and I could not for the life of me figure it out.

Thanks for the tips guys!

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 meat5000 ♦ · Oct 23, 2013 at 12:44 AM 0
Share

Accept your answer :P

avatar image rednax20 · Oct 23, 2013 at 01:14 AM 0
Share

force creates a movement that can be increased exponentially, and be slowed by other forces like gravity angular drag (friction) while keeping there added momentum. transforms are simpler and are often enough (if not better) for a quick not necessarily realistic game. (by realistic i mean like a game where a ball has to fall in precis places, not like galaga no matter what the graphic quality);

each has its own ups and downs i was just wondering incase it made a difference, again i didn't know what caused the problem. although it looks my rigidbody idea help you solve it.

Quishtay all the way

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

Collision, change skybox in game 1 Answer

Parent Object 0 Answers

Enable objects to enter the trigger 2 Answers

Have script detect which collider 2 Answers

Object Carry 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