drag an actor anywhere

GamepencilerGamepenciler Artist/Game DeveloperMember, PRO Posts: 326
I'm trying to make an actor follow and drag anywhere at the screen but I don't seem to be successful with it. It jumps choppily and I only can click along the actor size. I have the file here, can somebody tell me what's wrong with it?

Artist/Game Developer / Animator at your service..

Best Answers

  • KevinCrossKevinCross London, UKPosts: 1,894
    edited October 2013 Accepted Answer
    Use constrain instead of change attributes.
  • KevinCrossKevinCross London, UKPosts: 1,894
    Accepted Answer
    Try interpolate:

    Rule (Any): If touch is inside or touch is outside
    Interpolate: self.Position.X To game.Mouse.Position.X (change duration for speed)
    Interpolate: self.Position.Y To game.Mouse.Position.Y (change duration for speed)
  • KevinCrossKevinCross London, UKPosts: 1,894
    edited October 2013 Accepted Answer
    You'll find that with Interpolate it's the duration it takes to get from point A to B, and not the speed, so small movements will take the same amount of time as long movements, but it will travel faster for longer movements as it's got more ground to cover in the selected duration. You could get fancy and calculate the distance and adjust the duration accordingly but you may find it fine as is.

    If you can get "Move To" working that might be a better option as that uses speed.
  • jamie_cjamie_c ImagineLabs.rocks Posts: 5,772
    Accepted Answer
    @ecanhoj, I've re-attached your file so it works now. I just added the Constraints like Kevin mentions. It does not crash on my machine.
  • KevinCrossKevinCross London, UKPosts: 1,894
    Accepted Answer
    You have to keep in mind that with "Move To", or "Interpolate" you can no longer drag the actor. Constrain is the best way to drag the actor. It drags reasonably smooth without any major jumps.

Answers

Sign In or Register to comment.