Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 chum10 · Aug 14, 2015 at 02:15 PM · raycastreflectionraybeam

Magicka-like beams. How to approach this.

Hello guys.

I'm making a Magicka: Wizard Wars clone in Unity just for fun. So far I managed to plan and code most of the spell types (mines, storms, projectiles, etc...), but there's one that I have no idea how to approach: beams. At first I thought a simple raycast would be enough, but the problem is that beams collide with eachother too so you can deflect beams with other beams. Do you guys have any idea how can I code the beams? Just to clarify, I'm not asking you to do the work, I just want some ideas on how to approach this because I keep thinking about it and I can't figure it out. Maybe there's some physics function I don't know about or something. Any help will be much appreciated.

Thank you for your time :)

Comment
Add comment · Show 4
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 chum10 · Aug 14, 2015 at 01:52 PM 0
Share

Sorry, I phrased that really badly. I need the beams to collide with eachother and I can't do that with a raycast, because they only hit colliders not other raycasts.

The only way I found that works decently is creating a procedural collider the length of the beam. I just wanna know if there's a better way.

Thanks for your reply :)

avatar image Cherno · Aug 14, 2015 at 04:48 PM 1
Share

You could do it purely by code using some mathematic calculations to see if thwo rays overlap. Otherwise, I think it'd be easiest to indeed use temporary mesh colliders/triggers.

avatar image DwaynePritchett · Aug 14, 2015 at 05:58 PM 0
Share

Would it be possible to just put a sphere collider at the end of the beam? Something like a DBZ $$anonymous$$amehameha Wave? Just fake the other part of the beam? Or, do they need to intersect as well as collide head on?

avatar image chum10 · Aug 14, 2015 at 06:41 PM 0
Share

The sphere at the end of the beam wouldn't work. I need something to detect where the beams cross.

It looks like I have to do it with the collider. I don't think I know enough maths to do it just purely mathematically.

Thanks for the suggestions, guys. I really appreciate you taking the time to answer.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Wiki

Answer by vulpineblazeyt · Aug 14, 2015 at 07:25 PM

I was able to make a laser beam by using this tutorial:

Expandable Laser Tutorial

... and then giving the center piece of a laser collidable properties.

Change the sprite so something more magic-relevant and this should work.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

LineRenderer (Laser Beam) is not following the ray it's going on the wrong direction when reflecting 1 Answer

camera.ScreenPointToRay always has same origin... 1 Answer

Printing Distance b/w two points using line renderer and Raycast 1 Answer

How can I can I cast a ray from a gameobject? 1 Answer

Raytracing through an octree? 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