playMaker

Author Topic: Classic swipe to rotate 3D object  (Read 4949 times)

iloveaphextwin

  • Playmaker Newbie
  • *
  • Posts: 8
Classic swipe to rotate 3D object
« on: April 21, 2013, 03:45:04 AM »
Hi there,

This is a classic problem but I can't seem to find any information on how to do this with playmaker. I have a 3d object in the scene a nice cube, I want to be able to swipe and rotate this object. The user can swipe a few times to keep speeding up the object, but it will slow down on it own over time. I also want it so that when you touch and hold your finger still the object will stop.

I have something basic working using Physics.AddTorque on impulse. It gets the difference between my X and Y start and end touch positions and adds that as torque to my object. This creates pretty nice smooth action but now I can't get the object to stop quickly.

Should I be setting the objects rotation directly using variables like speed and xdifference. Or is the adding forces with physics route the best way to go?

Thanks for your help

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Classic swipe to rotate 3D object
« Reply #1 on: April 22, 2013, 01:07:51 AM »
Hi,

 adding torque will give you some pretty easy results, else you will need to animate the float variables and that's more involving.

bye,

 Jean

iloveaphextwin

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Classic swipe to rotate 3D object
« Reply #2 on: April 22, 2013, 07:48:29 AM »
Thanks for the reply. Can you tell me a little bit about torque.

I need to be able to fairly quickly remove any torque on my object when the finger is stationary on it. I couldn't seem to do this. I have to be able to stop the torque and then get it to follow your finger before you throw it again.

I guess on fingerDown track and move object, on release get speed of finger and add torque to it.

I also had trouble working out the angle to add when using torque.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Classic swipe to rotate 3D object
« Reply #3 on: April 23, 2013, 02:49:02 PM »
Hi,

 uhm, in that case, you might actually want to control the angle directly, cause torque control will be difficult in your case.  You could mess with the angular drag of the object tho.

bye,

 Jean

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: Classic swipe to rotate 3D object
« Reply #4 on: April 24, 2013, 01:42:02 PM »
Did you try to set your object to "sleep" to stop it (when using physics)? for my objects this worked good!

iloveaphextwin

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Classic swipe to rotate 3D object
« Reply #5 on: May 01, 2013, 05:26:49 AM »
Hi there,

I found the sleep function. This is actually working really well for me now. I just need to figure out how to handle my inputs better through playmaker. Add torque is pretty good even for the slow movements.