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 Jeston 1 · Oct 06, 2010 at 07:31 PM · collisionraycastbullet

Unity3 CollisionDetection.Continuous for Bullets causing ricochet

I noticed some new rigidbody flags for collision detection methods in unity 3 so I am playing around with it now but was curious if anyone has tried to make a bullet with the new collision routines.

I added a rendertrailer to my bullet sphere and notice that the bullets are ricocheting around the static level mesh as opposed to calling 'OnCollisionEnter' when it ricochets... I guess we still have to do a raycast on a per frame basis?

The docs don't really give many details about the implementation of each flag: ContinuousDynamic, Dynamic, and Discrete.

So it is still better to mark a bullet as Discrete and raycast old -> new position each frame?

Comment
Add comment · Show 2
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 Herman-Tulleken · Oct 27, 2010 at 01:42 PM 0
Share

Yup, I had the same problem: http://answers.unity3d.com/questions/20105/why-is-oncollisionenter-not-always-called. Using triggers ins$$anonymous$$d did not solve my problem.

avatar image Jeston 1 · Oct 27, 2010 at 08:16 PM 0
Share

I basically ditched the new unity 3.0 features and kept with the old methedologies of raycasting old position -> new position and checking the info that gets passed back.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Peter G · Feb 27, 2011 at 02:52 PM

Your walls also have to be set to ContinuousCollisionDetection. Dynamic CCD is for moving objects and CCD is for any objects that they can collide with.

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 George Profenza · Oct 11, 2010 at 07:20 PM

I just started with unity, and don't fully understand the question, but are you trying to stop the bullet or handle a bullet collision ?

I wanted to stop projectiles into a wall, so I added a box collider to my wall, then looked for projectile collisions using tags:

function OnCollisionEnter(collision : Collision) {
    if(collision.gameObject.tag == "projectile")
    {
        print("projectile hit at: " + collision.relativeVelocity.magnitude);
        Destroy(collision.rigidbody);
    }
    for (var contact : ContactPoint in collision.contacts) {
        Debug.DrawRay(contact.point, contact.normal, Color.white);
        print(contact.point);
    }
}

HTH

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

1 Person is following this question.

avatar image

Related Questions

Raycast from inside an object 2 Answers

Bullet Shoot with RayCast don't destroy onCollisionEnter 1 Answer

Bullet Effect 2 Answers

RayCast Problem : 2d 1 Answer

Raycast bullet collision problem 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