playMaker

Author Topic: guiding missile  (Read 8084 times)

SilverApe

  • Playmaker Newbie
  • *
  • Posts: 6
guiding missile
« on: May 12, 2011, 06:17:06 AM »
Hi All,

I am trying to make a guided missile to go to the object I click on. Sadly this does not work, the missile most of the time gets close but sometimes even not that.

I have this now (see attachment), for testing but at the end I would like the rocket to follow the clicked target (now it goes to the clicked position). But my testing is also not working :)
In my test scene I have a moving target, a static player and a rocket prefab.

Can anyone explain what is wrong with my setup and maybe (would be really nice) explain to me how to make it so it follows the clicked target.

I anymore info is needed please let me know.

thanks in advance.
greetings,
Aaron

IPete2

  • Playmaker Newbie
  • *
  • Posts: 23
Re: guiding missile
« Reply #1 on: May 12, 2011, 05:58:22 PM »
Hi Silver,

Here's what I have working based on the Mouse Pick video on You Tube.

I have an empty game object with an Input Manager fsm on it - see image screen2.jpg (and screen3.jpg).

This checks for input and stores true in "Did Pick Object" variable if it is true.

Screen3.jpg shows what to do when there is a mouse or touch pick, set the target position to the hitpoint vector. Broadcast the event to the object you want to follow (in my case that is Murtle).

Now look at screen1.jpg and you see it is on Murtle. I use Move Towards and smooth look at (to get it to turn to face the target).

My camera also has a smooth follow on it too.

Hope this helps some.

IPete2.

 

IPete2

  • Playmaker Newbie
  • *
  • Posts: 23
Re: guiding missile
« Reply #2 on: May 12, 2011, 06:12:57 PM »
Hi Silver,

Here's what I have working based on the Mouse Pick video on You Tube.

I have an empty game object with an Input Manager fsm on it - see image screen2.jpg (and screen3.jpg).

This checks for input and stores true in "Did Pick Object" variable if it is true.

Screen3.jpg shows what to do when there is a mouse or touch pick, set the target position to the hitpoint vector. Broadcast the event to the object you want to follow (in my case that is Murtle).

Now look at screen1.jpg and you see it is on Murtle. I use Move Towards and smooth look at (to get it to turn to face the target).

My camera also has a smooth follow on it too.

Hope this helps some.

IPete2.

SilverApe

  • Playmaker Newbie
  • *
  • Posts: 6
Re: guiding missile
« Reply #3 on: May 13, 2011, 04:08:20 AM »
Hi IPete2,

It works like a charm!  :D I managed to replicate your setup.
Now lets see if I can modify it so it follows the target until it hits it.

thanks for your help.

greetings,
Aaron

SilverApe

  • Playmaker Newbie
  • *
  • Posts: 6
Re: guiding missile
« Reply #4 on: May 13, 2011, 08:38:24 AM »
Hi,

I played a little bit with your solution and as I said it works perfectly but I think "translate" gives a nicer missile movement then "move towards" (it always goes forward and the missile then turns slowly as it "looks at" the touch point). But I would really like it to follow the target. I tried different options but none of theme work.
It should update the positon of the target and give the values to the rocket (all the time) but I can't seem to get that right.
Does anyone have an idea how to achieve that?

thanks,
Aaron

IPete2

  • Playmaker Newbie
  • *
  • Posts: 23
Re: guiding missile
« Reply #5 on: May 13, 2011, 12:35:59 PM »
Hey Silverape,

Glad it worked somewhat.

I think what you need to do is try to get the gameobject which is touched and pass that to become the target.  I'll try to have a look at home tonight and let you know what I find.

IPete2

SilverApe

  • Playmaker Newbie
  • *
  • Posts: 6
Re: guiding missile
« Reply #6 on: May 14, 2011, 03:08:11 AM »
Hi IPete2,

Your help is much appreciated.
I will keep on trying myself to.
It is fun to play with these things but after a while when nothing seems to work and you are getting nowhere it starts to get a little bit frustrating  ;)

And now it is just one target, but ofcourse in the real game there are going to be many, so I think I wil have to pass the target id to the missile to, am I right? So when I click on the next target, all the missiles flying around don't go to the next target but keep on following their own target. Well, first things first  :D

greetings
Aaron

IPete2

  • Playmaker Newbie
  • *
  • Posts: 23
Re: guiding missile
« Reply #7 on: May 14, 2011, 03:44:21 AM »
Hi SilverApe,

You probably want to think about and plan for the different things which may need to be addressed because it can affect how you approach the whole problem to begin with.

In this case you may want to have several options.

(a) target a single 'locked on' target and keep locked on until the target is destroyed, or the missile hits something else by accident, or runs out of thrust/fuel

(b) target the 'target' which is nearest and not yet destroyed, keep going until its hit ot runs out of fuel / thrust.

(c) you could set up an array of objects you can consider targets and index through them

I haven't ahd time to look at targeting a gameobject yet, but will do today.

IPete2.

SilverApe

  • Playmaker Newbie
  • *
  • Posts: 6
Re: guiding missile
« Reply #8 on: May 14, 2011, 09:34:14 AM »
You are right, it is good to know what you wan't before you start.
My intention was to make something like (a)

I was doing the other thing to learn and see how I could accomplish things.

greetings,
Aaron

MaDDoX

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 165
    • FluidPlay Studios
Re: guiding missile
« Reply #9 on: May 15, 2011, 03:01:20 AM »
It's very nice to be able to "draw your logic" and prototype in playmaker but for some performance intensive behaviors like that, I'm quite sure you'd get better performance / smoothness with a custom action. This is exactly the kind of thing that I wouldn't personally have a problem to try and do in code, but if you want to stay visual you would consider uScript once it's released - since it can compile its graph network to a custom playmaker action in C#.

That said, I'm sure that as Alex improves Playmakers' performance this "gap" might shorten dramatically. In any case, please consider compiling your game (output it to an executable) and check if the - vast, btw - performance gain improves the smoothness problem.
--
Breno "MaDDoX" Azevedo
@brenoazevedo

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: guiding missile
« Reply #10 on: May 15, 2011, 07:24:10 AM »
It's very nice to be able to "draw your logic" and prototype in playmaker but for some performance intensive behaviors like that, I'm quite sure you'd get better performance / smoothness with a custom action. This is exactly the kind of thing that I wouldn't personally have a problem to try and do in code, but if you want to stay visual you would consider uScript once it's released - since it can compile its graph network to a custom playmaker action in C#.

That said, I'm sure that as Alex improves Playmakers' performance this "gap" might shorten dramatically. In any case, please consider compiling your game (output it to an executable) and check if the - vast, btw - performance gain improves the smoothness problem.

I've seen the uScript website but haven't dug into it all that much. What makes uScript faster than Playmaker? And can uScript really create custom playmaker actions or do you need to take the code it creates and create the custom action yourself?

Just wondering what evidence there is of uScript being faster than Playmaker since uScript isn't even out right?

IPete2

  • Playmaker Newbie
  • *
  • Posts: 23
Re: guiding missile
« Reply #11 on: May 15, 2011, 10:55:46 AM »
Hey SilverApe,

Ok you need to use Mouse Pick and store the GameObject you targeted(touched).  Set up a GameObject variable to achieve this, and use that as the target.

You could alternatively make the invisible target which you used to make the missile fire towards where you touched a position on the screen stick to the nearest gameobject with a Tag type of enemy, thus following it about by always trying to be at its position.

Hope these ideas help.

IPete2.

SilverApe

  • Playmaker Newbie
  • *
  • Posts: 6
Re: guiding missile
« Reply #12 on: May 17, 2011, 05:21:18 AM »
Hi all,

To MaDDoX.....wow on uScrip, really a nice peace of software and I am sure going to give it a good try! Thanks for the pointer
To IPete2
I tried some of those thinks you mentioned before, but they did not work very well for me. I am going to give it another try, I must be missing something

I will let you know if I get it working!

geetings,
Aaron