playMaker

Author Topic: How to touch and drag a 3d object?[SOLVED]  (Read 40311 times)

Slater

  • Full Member
  • ***
  • Posts: 123
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #15 on: November 12, 2012, 09:55:23 PM »
Hi, Yeah I could use a sample for it. I am still confused to where to put stuff.

We launched the website yesterday. You can check it out here www.hannahenri.com and see how it looks. Would be nice to be able to update the drag thing for mouse soon.

I really appreciate your help Jean. Without your help here I would have had a much harder time as a new programmer.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #16 on: November 13, 2012, 01:11:19 AM »
Hi,

 this is odd, I can't access your site, maybe it's just some dns issues.

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #17 on: November 13, 2012, 06:27:47 AM »
Hi,

 ok, Just did a working sample for a small game startup and it features a drag system that works both with Touch and Mouse, basically I copied the drag Fsm and replaced the actions to move from touch to mouse.

http://hutonggames.com/playmakerforum/index.php?topic=2544.msg11501#msg11501

If you don't own MegaFier, simply delete the offensive Action. I have also disabled the rendering of the dragged gameObject, but you can simply turn it on to really witness the dragging.

bye,

Jean

Slater

  • Full Member
  • ***
  • Posts: 123
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #18 on: November 14, 2012, 02:18:48 PM »
Thank you so much. Through the example I could work it out and make it work in my scene. The website is up so you should be able to check it out.

Either www.hannahenri.com or www.hannahenri.se

Cheers!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #19 on: November 15, 2012, 01:16:56 AM »
Hi,

 good. Tho I am still unable to view your domain, maybe it's just a glitch because I am in Russia.

bye,

 Jean

Slater

  • Full Member
  • ***
  • Posts: 123
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #20 on: February 09, 2013, 08:21:29 AM »
Could use some help again here. In one of my scenes I have pictures in a row. I have them all grouped under one empty game object that has a collider. I have locked it so that I can drag the row up and down and all works well except that when I release the finger and then touch again to move the row further up or down, the row centers itself back to original finger center position. Any suggestions what I can do to not have it center back?

Slater

  • Full Member
  • ***
  • Posts: 123
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #21 on: February 20, 2013, 08:12:42 PM »
Any suggestions?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #22 on: February 21, 2013, 12:46:50 AM »
Hello,

 that's difficult to say as is, but it's likely because you don't take in account the current scrolling value.

 say scroll 0 is top, and scroll 1 is when you have scrolled all the way down.

if you drag to scroll 0.3, release and start dragging again, you need to take in account that the scroll is 0.3 and thus offset the touch drag delta position to ADD to the scroll and not SET the scroll.

 does that make sense?

bye,

 Jean

Slater

  • Full Member
  • ***
  • Posts: 123
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #23 on: February 27, 2013, 04:51:52 AM »
Thank you. Yes it makes sence, just see if I can figure out how to do that :)

Slater

  • Full Member
  • ***
  • Posts: 123
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #24 on: May 06, 2014, 07:43:16 AM »
Hi, I am back :)  I am now back to this problem over a year later, crazy. I have a new project where I need to drag the scene around(alternatively move the camera). It is 2d. I have the background and all the objects in the scene grouped under an empty object I call "wrapper". The camera is "zoomed in"(lower orthograpic size). I have set the "wrapper" to be draggable and can move the whole scene around with my finger on the iPad. The problem is that when I release the finger from the screen and then put it back on to continue moving it the "wrapper" resets the center point to where the finger is.

What is it in the fsm that makes the object, in this case the "wrapper", move and center to the position? What can I do to make it start from the position it is currently in without resetting to the finger.

I also need to set a limit on how much you can drag it in x/y position, so that you don't drag outside the edges of the texture image. Any suggestions on this?

Thanks/
Slater
« Last Edit: May 07, 2014, 08:32:37 AM by Slater »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #25 on: May 14, 2014, 07:17:06 AM »
Hi,

 you need to use a relative translation as opposed to an aboslute, so when you drag and object around, you don't move it to the position of the finger, you translate it everyframe by the amount of drag for that frame.

 does that make sense?

 as for your limitation, one easy way, without getting into too much math is to use triggers, simply suround your area with virtual walls ( triggers) and when your object touches them then you don't allow movement further in "that" direction.

 Tell me how you get on with this, it's quite a hot topic, so if you keep struggling, I'll see if I can make a micro sample showing this.

 Bye,

 Jean

Slater

  • Full Member
  • ***
  • Posts: 123
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #26 on: May 14, 2014, 05:45:35 PM »
I kind of understand the theory of how to do it. I just don't manage to figure out how to do it with the tools I have in Playmaker. I will probably go "ahhh" how stupid of me, when I see the solution heh, but I have a hard time on how to actually make it work.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #27 on: May 15, 2014, 01:06:12 AM »
Hi,

 Do you have Input.touches? I just did a similar demo yesterday for it.

Bye,

 Jean

Slater

  • Full Member
  • ***
  • Posts: 123
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #28 on: May 19, 2014, 06:03:22 PM »
No I don't. Guess it wouldn't be to bad to get it though, just haven't done it since I haven't needed it so far. I am in no hurry anymore to get this solved since I didn't get the contract unfortunately, but it would still be great to have it sorted to be able to use it in the future in other projects or to implement it in current apps where it could be useful.

Redhawk

  • Junior Playmaker
  • **
  • Posts: 57
Re: How to touch and drag a 3d object?[SOLVED]
« Reply #29 on: June 03, 2014, 01:37:02 PM »
I tried out the sample you created for moving the object.  The moveable/dragable cube goes straight through the other cube.  No collision whatsoever.  Objects shouldn't be able to move through the other.  How can I fix this??? :)