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
1
Question by Tyler 1 · Nov 01, 2010 at 06:22 AM · mousesystemparticleaimingside-scrolling

2D game with 360 degree aiming and shooting a particle system... help please

I've seen similar questions as this one, but none of the answers I've seen apply to this particular situation. I'm using the 3d platformer (Lerpz) tutorial to test out a few gameplay features that I want in my game prototype. I'm having trouble creating telekinesis powers. Right now, I have the particle system shooting when I click the mouse, but it's just going in the positive x axis, since it's using the particle system's velocity... I want it to go wherever I'm clicking the mouse. I think I have a handle on the steps to complete this, but I'm looking for similar scripts since I'm not used to C# or JS. This seems like a fundamental need for anyone make a side scrolling game, so I'm surprised I haven't seen many good answers or threads yet.

I assume the steps go:

  • Create a particle system then put it in a game object then make it a child to the player so it moves with it. (Done)

  • Make the mouse cursor the aiming point/crosshair. (I only know how to do in a FPS)

  • Make a script or somehow get the particles to shoot at the location where I'm pressing the mouse (no idea on how to do this)

  • Add force to the particle system so it pushes objects. (I think I have an idea on how to do that)

Update: The question is still unsolved since the other method was a no go.

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 Proclyon · Nov 01, 2010 at 12:33 PM 0
Share

I have your answer , I was interrupted and now stuck in workshop!! I will post a full step plan soon ok to get the vector you need, hang in there! :D

And don't bother with particles yet , start with Destroy(Instantiate());

avatar image Proclyon · Nov 01, 2010 at 01:59 PM 0
Share

Finally done! Inc explanation

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Proclyon · Nov 01, 2010 at 02:30 PM

I am glad you are asking this question! I have been doing exactly the same trying to build a firing crosshair based 2D element into my project!

Ok , so you need to shoot at a specific target point with a cursor on your screen in a 2D environment without using to much trigonometry. That I can help you out with.

To build the crosshair go to GameObject --> Create Other --> GUI Texture, name it crosshair and then create a C# Script (I prefer C#, not required but I can't explain it in JS I'm afraid)

Create the script doing Assets --> Create --> C# / JS Script

You also have to make your crosshair on a part of your GAME screen and NOT your VIEW screen. Your screen is irrelevant to the game and 50% of the game screen in windowed mode will not be 50% of you screen. I suggest you take a % value of the screen by getting the mouse information. Unity scripting has a getter for that Screen.width and Screen.height use them for the GAME window sizes (Wish I Could just post the code....)

For shooting you will need the coordinates!

I help you get started with that but I have not got it working yet since spawning an object with Instantiate has an origin but not a Target , it works with forces so I'm still looking for a way out without Trigonometry or somehow creating a force value with the Vectors that matches the direction it would go X and Y wise so it's be exactly what u were looking for.

So far I have been trying these following things: Extrapolate the original vector using the transform of the object (gun or something else that shoots as long as that's the object the ammo should be coming out of), You may need to fiddle with the offset later Create the target Vector with transform.TargetDirection( x_value , y_value , 0.0f )

This will give you the locations and now you can just LERP (Linear Interpolation(Connect the dots in straight line with 2 dots)) the two together but that's where the help stops. I still have to do that myself aswell.

I tested the vector info and it works perfectly in all screens and resolutions for me!

<<<

I had intended and finished posting the full code samples which would save you about a day of work , but I just asked and that is pretty much "Not done" , I apoligize for getting your hopes up, but IP = IP :( it's that or get in a LOT of trouble for me and my work here, so I hope this stripped down crappy answer will get you on your way. It's probably ok for me to link POST-production but by then it's probably to late.

F.Y.I. I am 100% Anti IP, can't help it TODAY. But I keep trying ^^ Knowledge4All

<<<

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 Tyler 1 · Nov 01, 2010 at 04:45 PM 0
Share

Thanks for your reply, things are a little bit clearer now. I sent you a P$$anonymous$$ on the Unity (forum) site, since I have a question regarding what you said and it working with the particle system.

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

how do i make somthing rotate with mouse 1 Answer

Mouse Aiming Follow Wrong Direction - Help 2 Answers

ellipsoidparticleemitter 1 Answer

Aim at mouse error 1 Answer

New Input System: Event on input type changed (between mouse, keyboard and controller) 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