Author Topic: Input Touches Angular Force  (Read 2037 times)


  • Junior Playmaker
  • **
  • Posts: 50
    • View Profile
Input Touches Angular Force
« on: July 22, 2013, 03:02:55 AM »
Hi there,

I'm using Input.Touches and the playmaker custom actions

Getting the swipe info such as angle and speed is great, but how do I translate that into force on an object?

The 'Add Force' action is great, but it only uses a vector3... Is there any way of using an 'Add Force' type action, but rather than pass it a vector3, pass it a float for the angle and a float for the speed? That would make my life so much easier! lol



  • Administrator
  • Hero Member
  • *****
  • Posts: 15210
  • Official Playmaker Support
    • View Profile
Re: Input Touches Angular Force
« Reply #1 on: July 29, 2013, 02:18:31 AM »

 the relation between your swipe and the force direction and magnitude is always requiring tweaks because the force is added in a 3d world, not in 2d.

so, to do this, you need the following:

-- the direction of the force. Is it related to the swipe direction? and how does that translate into your 3d world? are you implementing a 2d game or is it really a 3d game?

-- as for the magnitude of the forec, you will always need to have a multiplier, so get the magnitude of the swipe, apply your multiplier and then multiply the value to the direction vector defined above, this will be your final vector to inject in Add Force.

now, to get a direction based on a gameobject ( say you want to push a gameobject always from behind itself), use the action "Transform Direction" and define the local axis ( for example 0,0,1 will be the forward direction)

Could you explain what you are after in the end? I might have already a sample that match your needs for you to study.




  • Junior Playmaker
  • **
  • Posts: 50
    • View Profile
Re: Input Touches Angular Force
« Reply #2 on: August 02, 2013, 03:29:20 PM »
Hey Jean,

I've been in contact with the guy that made input.touches and he's been really helpful! He essentially told me the same thing you just did.

I have it rigged up and it works pretty well! The only problem I'm having is that the triggering of the 'swipe' event doesn't seem to be sensitive enough...

What making with this is a dice thrower. So the player can touch the dice with their finger to pick it up, then swipe and let go to throw the dice in a direction. If the player takes their finger off the dice without swiping then the dice just drops straight back down. It's all 3d with a perspective camera, but the camera is stationary looking down on the board and not moving.

Right now the swipe event is triggering about half of the time, even when you swipe really hard sometimes. It may be the way I have the fsm setup... When the dice is being touched, it is in a 'touched' state. This is also the state that listens for the swipe... If you swipe while you're in the touched state, it goes straight onto a 'lift check' state that checks to see if the player has lifted their finger from the dice, releasing it for the throw. It's literally just a Touch Event action listening for the 'ended' phase. If it's ended, then it throws the dice using the info from the swipe, if not then it goes straight back to the 'touched state'. I'll have a bit more of a play around with the setup and see if it works better another way...