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 /
avatar image
1
Question by dhendrix · Feb 04, 2010 at 04:36 AM · collisionphysicscollider

Arcade Physics and colliders

I'm doing a top down space shooter type game, and I need the player to react to everything in different ways.

  • For walls, collide and stop movement (unity handles this well with a primitive collider for the wall)
  • For projectiles, damage and brief invulnerability(which is easily handled with scripting), but I do not want the player to be pushed in any way at all, but I still need to detect the actual collision
  • For enemies, I'd like a slight bounce of each other, but nothing too crazy(maybe larger enemies not moving at all)

So what are the best colliders to use? I've tried primitive + Rigidbody with isKinematic = true, this gets me close, but I go right through static walls, and movement with transform just doesn't seem as smooth as adding a force to a rigidbody. Sorry if this question seems long.

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

3 Replies

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

Answer by duck · Feb 04, 2010 at 10:04 AM

I'd probably do this:

Walls
Yes, primitive colliders are good. Also good is the 'mesh' collider, with its 'static' setting enabled, if your environment is built in an external 3d app. If your environment has complex geometry, you might find that you want to use simpler invisible 'proxy' geometry for the collisions, while still displaying the more complex meshes as the graphics.

Projectiles
If you don't want the projectiles to actually push the player when they hit, use triggers (as has been mentioned in another answer). You can then apply damage and destroy the projectile in the OnTriggerEnter function. Of course there's nothing stopping you from also applying a force in that function - eg, if the projectile is supposed to be explosive, there's even a specific physics function to AddExplosionForce which you could use here.

Enemies
It sounds like you want to create a custom physics material which has a very low value for "Bouncyness". Just use the "Create" menu in the project pane to create a new one, set your settings, then drag it on to the enemy gameobject. It should automatically be placed into the collider's material variable.

Hope this covers everything.

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
1

Answer by Sebas · Feb 04, 2010 at 05:27 AM

Just a thought on the player-projectile collision: From what I've seen in other engines --> a problem that the high speed of the projectile could be an issue that it could actually pass through the player/target/etc. between two frames (or physics steps) and collision is not registered. How about ignoring collision (link) between projectile and player and casting a ray instead and triggering your damage and invulnerability this way? Just a thought, so don't mind me if that's not what you want.

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 dhendrix · Feb 04, 2010 at 05:51 AM 0
Share

Actually, I think I'll just set the projectiles as triggers, don't know why I didn't think of that before. That solves one of my problems.

avatar image Jademyr · Feb 04, 2010 at 03:03 PM 0
Share

I agree, rays is the way to with projectiles.

avatar image
0

Answer by runevision · Feb 04, 2010 at 09:50 AM

You can't use isKinematic = true if you want the object to respond to collisions at all.

Would there be any problem in just using a ridigbody (with isKinematic = false) and moving the ship by applying forces? When your projectiles are triggers they shouldn't cause the ship to move.

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

No one has followed this question yet.

Related Questions

No Collision 3 Answers

Do you have to have a rigidbody component for collision detection? 1 Answer

AI Players Movement for Rolling Ball Game 0 Answers

Big issue with colliders 1 Answer

How having correct bounce on a rotating pinwheel(it's more complicated)? 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