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 gabenator123 · Mar 01, 2015 at 10:14 PM · raycastparticlesparticletrail

Is there a way to draw particles on a raycast?

In my game one ability uses a raycast to determine where the shot hits. Is there any way to draw a trail along the raycast? Can I spawn particles along certain intervals on the raycast?

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 Haxxxxx · Mar 01, 2015 at 10:30 PM 0
Share

Are you talking for debug purposes or for actual in game purposes (for example, a laser)?

avatar image gabenator123 · Mar 02, 2015 at 01:52 AM 0
Share

in game purposes.

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by karljj1 · Mar 01, 2015 at 10:20 PM

Vector3.Lerp or Vector3.MoveTowards are what you want here. Take your current position and the point your ray hits and move towards it and instantiate an object at each step.

E.G

 float step = 1f / numberOfObjectsIWant;
 float currentStep = 0;
 for( int i = 0; i < numberOfObjectsIWant; ++i )
 {
     currentStep += step;
     Vector3 position = Vector.Lerp( whereIAm, whereMyRaycastHit, currentStep );
     // Create object at position 
 }

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 gabenator123 · Mar 02, 2015 at 01:53 AM 0
Share

Jeez, Lerp is insanely useful.

avatar image khauschild · May 01, 2017 at 07:58 PM 0
Share

I am trying to do the same thing! But, I am not much of a coder, I am more of a designer and have been using playmaker for VR. Could you guys help me at all with how I would do this, I am guessing I can not just drag and drop that code as a script?

Thanks!

avatar image
0

Answer by khauschild · May 02, 2017 at 02:43 PM

I am trying to do the same thing! But, I am not much of a coder, I am more of a designer and have been using playmaker for VR. Could you guys help me at all with how I would do this, I am guessing I can not just drag and drop that code as a script?

Thanks!

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make particles not change rotation with emitter after they have been emitted? 2 Answers

Sparks for unity raycast gun script 1 Answer

Is the trail emitted by the Trail Renderer "billboard"? 1 Answer

how to rotate particles in a particle system 1 Answer

Move Particles 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