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 jacob johnston · Jan 16, 2011 at 10:45 PM · instantiatebullet

scripting question

i want to make it so where ever my bullet hits (the ground or an object in the game) something that it lets me know the point in 3d space so i can Instantiate a small smoke particle system so it shows where i hit. how would i go about doing this 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 Jessy · Jan 16, 2011 at 11:06 PM 0
Share

Title your question better and use better tags.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by zharramadar · Jan 17, 2011 at 02:05 AM

Indeed, you should clarify your question, and put a more specific title and tags, that would help you getting an answer.

I'll try to answer based on what I got from it...

You are making a bullet, and you want to check where the bullet hits, so in the collision spot, you can instantiate a smoke.

To do that, use Raycast. Take your bullet position and the vector defining the direction the bullet is going through, and make a raycast with it (Physics class).

Then, in the RaycastInfo object (or something like that), you can get the object and where in world coordinates the ray hit an object. Remember that layers count in Raycast, so specify the layers you want to be counted in the raycast or not.

Good luck =D

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 FLASHDENMARK · Jan 17, 2011 at 09:38 AM 0
Share

Hmm doable but to complicated. OnCollisionEnter is way simpler.

avatar image
0

Answer by jacob johnston · Jan 17, 2011 at 02:10 AM

thank you i will see where i can go from that

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 · Jan 17, 2011 at 02:23 AM 0
Share

Use comments to respond, rather than posting a new answer.

avatar image
0

Answer by FLASHDENMARK · Jan 17, 2011 at 09:35 AM

Or easy and simple...:

var hitExplosion : Transform;

function OnCollisionEnter (hit : Collision) { if(hit.gameObject) { Instantiate(hitExplosion,transform.position,transform.rotation); } }

Attatch this script to the prefab that you are Instantiating and when it hits it should instantiate a explosion(Particle effects). Just remember to assign the hitExplosion in the inspector and for best effects it should be a particle effect.

Hope this makes sence :)

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 _Petroz · Jan 17, 2011 at 10:55 PM 0
Share

I think one of the two objects needs to be a RigidBody and maybe be a "Trigger" too?

avatar image FLASHDENMARK · Jan 18, 2011 at 10:22 AM 0
Share

Hmm. I do believe that only OnTriggerEnter needs one rigidbody.

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

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Instantiate GUI text 1 Answer

How to add a bullet tracer effect to a raycast gun 1 Answer

Shooting Script Bullet Doesnt Fire 2 Answers

Terrain with lots of objects 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