playMaker

Author Topic: Click/Touch Drag an Object with Collision Detection  (Read 1574 times)

VectorF22

  • Junior Playmaker
  • **
  • Posts: 50
    • View Profile
Click/Touch Drag an Object with Collision Detection
« on: October 15, 2014, 08:58:15 AM »
Hi there,


There is a mechanic I'm working on in my game where the player can click/touch an object and drag it around the scene. It's exactly the same mechanic as you would find in Little Big Planet for the PSVita (

I've played around with a few different ways to get the dragging to work such as using the "iTween Move Update" and "Move Towards" actions which work quite well. The only crippling problem is that they don't respond to collision detection too well.... The blocks will go a big crazy while they fight between the "go here" of the action and the "don't go here" of the collision.

Is there a way that anyone knows of that would work well for this mechanic?

I have the "inputTouches" unity pack along with the Playmaker addon for it, but to be honest I can't seem to get that to work very well for this either... I may just be doing it wrong.

Thanks in advance!

jasperPT

  • Full Member
  • ***
  • Posts: 109
  • I am a VFX Animator teaching myself to make games
    • View Profile
Re: Click/Touch Drag an Object with Collision Detection
« Reply #1 on: October 16, 2014, 02:41:15 AM »
Im thinking perhaps create an object when you click, that stays with the mouse. Then move your "Selected" object towards this as the mouse is down.

Then the walls you want the selected object to collide with could have a rigid body on them with frozen transformations so that if your selected object collides they just hit it with whatever physics you want.

VectorF22

  • Junior Playmaker
  • **
  • Posts: 50
    • View Profile
Re: Click/Touch Drag an Object with Collision Detection
« Reply #2 on: October 20, 2014, 05:40:32 AM »
This could work, thanks for the idea Jasper!