Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

I need some help

Discussion in 'Game Design' started by duhanayan34, Nov 2, 2019.

  1. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    Hey, I am creating a game on my own in Unity 3D but i stuck somewhere. We control a hero in this game and dodging objects which coming from outside in a circle place. But I just did spells which moving to a point from a point. But I want to do objects which spawned random times and random places go towards to the hero and when spawned rotates itself to hero. For example when a spear spawned it will go towards to where the hero is.
     

    Attached Files:

  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    6,249
    Ok
     
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,844
    Sure
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    4,607
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    14,756
    You are aware "professional" just means someone is getting paid and has nothing to do with actual skill, right?

    What you want can be accomplished with these three methods. Use Random.Range to determine when and where to spawn, then use MoveTowards and RotateTowards to move and rotate an object in a certain direction.

    https://docs.unity3d.com/ScriptReference/Random.Range.html
    https://docs.unity3d.com/ScriptReference/Vector3.MoveTowards.html
    https://docs.unity3d.com/ScriptReference/Vector3.RotateTowards.html
     
    Martin_H and neoshaman like this.
  6. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    6,211
    This doesn't require a professional, it requires you posting in "getting started" or maybe the scripting forum.
     
  7. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    If i give you a link of discord or teamviewer would you help me? I know these things but I can't.
     
  8. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    Thank you all guys.
     
  9. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    nobody help?
     
  10. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    6,249
    With what? You haven't actually asked any question yet.
     
  11. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    I can't do what I want. I need some live support. I can give u discord if you would help me.
     
  12. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    How do I make a spear that goes towards the character's position when the spear spawned?
     
  13. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    6,249
    @duhanayan34 you don't need life support. You need learn to use search tools. Internet is full of tutorials an guidelines.

    As for discord, Unity has own channel. Go there if you think it may help you. I don't expect many active professionals there however.

    If you have specific questions, search first. If you fail to find an answer, then ask.

    As of the spear problem, search moving GameObject keywords.

    Also, you should visit Getting Started forum section.
     
    Joe-Censored likes this.
  14. TheKingOfTheRoad

    TheKingOfTheRoad

    Joined:
    Apr 24, 2013
    Posts:
    232
    LookAt it's the thing you want to research and experiment to look always at something.

    https://docs.unity3d.com/ScriptReference/Transform.LookAt.html

    About the random spawn system, it's just this:

    https://docs.unity3d.com/ScriptReference/Random.Range.html

    With this:

    https://docs.unity3d.com/ScriptReference/Object.Instantiate.html

    With this:

    https://learn.unity.com/tutorial/object-pooling
     
  15. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    Guys I already have read these pages but i can't do it. That's why I am here.
     
  16. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    Thanks anyway.
     
  17. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    6,211
    Why not?
     
  18. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    I don't know. Maybe I am incompetent.
     
  19. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    6,249
    Hard true is, programming is not for everyone.
     
  20. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    6,211
    What have you actually tried? What isn't working? Why haven't you posted this where it belongs, the Getting Started subforum?
     
  21. duhanayan34

    duhanayan34

    Joined:
    Nov 2, 2019
    Posts:
    11
    I tried research about it. I have found a script named Homing Missile. It is working as following the character. I mean rockets and spears are chasing the character. But I don't want it. I tried to make it using "Transform", "Translate" and "SetPosition" methods but I couldn't. :/
     
  22. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,746
    If you want help on this you need to state what you have already tried, include the code (use CODE tags when posting code), what you expected the code to do and instead what it is actually doing that is incorrect. If you aren't that far yet and don't really know where to even start, you should be going through tutorials in the Learn section or Youtube because the forum users aren't going to be able to tell you to do much more than that anyway.

    The forum is good for getting specific answers to specific questions, but not with teaching concepts that would fill an hour long video to teach. No one here is going to write a 5 page long description of every single step you need to take to do something somewhat complex.
     
  23. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,746
    Editing someone else's code to do something different than originally intended is actually a whole lot more difficult than writing your own implementation from scratch.
     
  24. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    3,926
    Only if you know how to program and know the api. If you don't know either, imho it's easier the other way around and make small steps toward the goal by making small changes to working code and applying lots of patience and trial and error. YMMV of course.
     
    Joe-Censored and Antypodish like this.
  25. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,746
    If you're doing some rather trivial changes, sure, in that case you don't necessarily need to understand everything the script is doing. But you're trying to change a Homing Missile script into something entirely different. That will be difficult to pull off if you don't both understand everything the script is already doing, and learn what you need to do to change it to what you want from it. Frankly I think it is easier to just do the second part and write your own script.
     
    Martin_H likes this.
  26. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    2,750
    Especially considering this is a beginner whose real focus ought to be more about learning thoroughly rather than trying to complete something over their heads quickly.

    To OP, i second the general consensus here to step back to square one and learn the fundamentals. You want to be at a point where you can do the logic in your head and know the tools to make it happen, but may be you get some little unexpected hiccup - then that is good time to use forum for help.

    Definitely not incompetent, just doing too much too soon. Don't beat yourself up. Take care of yourself, nobody else is going to.
     
    Joe-Censored and Martin_H like this.
  27. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    3,926
    I want to both agree and disagree at the same time, because for you and me what you say is true. But for my first gamedev project on iOS, using Cocos2D, I bought a "game template" that basically only had the core movement mechanic and camera perspective in common with what I wanted to make, and piece by piece I changed 99% of the codebase while learning both API and programming language from the example of the template. I thought it was a great way to learn and progress because everything was well documented and pretty much intended for what I was doing with it. In the end I think at most a couple of class, function and variable names where still the same but everything else was radically different. I'm not sure I'd have gotten that far if I hadn't "jumped in the deep end" and instead done a course on ObjC first and then started from scratch, because I think I might have lost motivation too quickly.
     
    BrandyStarbrite and Joe-Censored like this.
  28. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    14,756
    Before I comment further in this thread how many tutorials have you gone through for Unity? I can't imagine being unable to follow any of the information in the links I provided unless you haven't done at least some of the basic beginner tutorials.
     
    Joe-Censored likes this.