playMaker

Author Topic: add force in a set direction  (Read 2590 times)

varomix

  • Playmaker Newbie
  • *
  • Posts: 5
  • I eat pixels
    • varomix.net
add force in a set direction
« on: September 02, 2013, 02:17:34 PM »
Hi guys

I need your help

I have a 2d character that need to shoot and object in a direction set by the user, there's an arrow that the user moves around the character, once the player hits space I want the object to shoot at the direction the arrow is pointing by adding some force to it.

hope that's clear

thanks for the help

varomix

  • Playmaker Newbie
  • *
  • Posts: 5
  • I eat pixels
    • varomix.net
Re: add force in a set direction
« Reply #1 on: September 03, 2013, 02:52:25 PM »
What I ended up doing is adding a script and calculating the direction by hand

was actually trying to stay script free but now that I did it I want to do it more :)

Still, it would be awesome to have more low level actions to calculate this stuff, or I can roll my own right :)

thanks

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: add force in a set direction
« Reply #2 on: September 03, 2013, 03:41:04 PM »
It's not always more efficient to force something in playmaker when scripting it would be easier. If you know how to do both then you'll be able to use them together to really breeze through things.

I don't know enough scripting to write my own when it would be better, but Jean made a nifty action that may help you.

http://hutonggames.com/playmakerforum/index.php?topic=4066.0

For quickly throwing down some math its really great, but it is a really great tool.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: add force in a set direction
« Reply #3 on: September 11, 2013, 06:12:36 AM »
Hi,

 You don't really need runtime interpreter to achieve this. PlayMaker and its set of action can do that already actually.I have made an working example attached to this post.

basically, you take the mouse position, you convert it into world coordinates, BUT you have to set the right z value ( which is the distance from the camera, so in your case, I assume the gameObject that looks at the mouse is at 0,0,0, so I only need to get the camera z distance and invert it)

then, I have a world position to look at.

If you have questions, let me know.

 Bye,

 Jean