I'm working on a 2D non-game application. I used TouchScript to have all the multitouch gesture but I have an issue.
In the application, i have the ability to open a lot of popup that are draggable, pinch resizable and we can rotate them.
These popup are made with UIPanel. I add a collider2D on them
The issue is that when 2 popup are overlapping, if i want to move the one on top, i will randomly hit the one on the back or the top one.
It i like the touch goes through the first collider to hit the one behind...
First answering to the comment on your question suggesting to use the UI event system:
If you just use unity's UI events, you won't get advanced gestures such as swipe, pinch, etc and will have to code it yourself.
If you need these gestures, Touchscript is working fine and is a good choice.
Now to your question: I had the same problem and solved it by putting the script "UILayer" on the camera, instead of "CameraLayer2D"
Related
I have a right, left and up button on the screen (its a 2D game). I am trying to figure out how to write a script so that when the user clicks the buttons, they receive the input and either move the player right left or up. I have watched some tutorials on Youtube but they are from a couple of years ago and are out of date and don't work for me. Could anyone send me a script or tell me how to code it (C#) so that it can recognise the touch input?
Functions OnMouseDown, OnMouseUp, OnMouseDrag, OnMouseUpAsButton etc. work excellent not only on PC but on Android, too.
But don't forget than you must add BoxCollider2d to the pbject to make these functions work:)
I am working on a 2.5D side scroller/platformer project just kind of as a learning experience. I imported a robot model that came with premade animations. I have 2 questions regarding setting him up for movement and his animations. First, I set up movement for x and y, but do I only need to do x? Right now if I hit the UP arrow, the character appears to jump, but feel like that is probably bad form. Am I correct in assuming I should do just the x value for movement and create a separate method for jumping? My second question is with the animation controller. I set up all my states and set my transitions, but I'm not sure what to do from there. What do I do to actually set up the transitions, if anything, and also I could use some information on setting up the animations on the programming side. I have some very slight general knowledge of it, but not much and I'm having trouble finding good solid tutorials for these specific questions.
Thanks for the help!
Yes, I would recommend doing separate controllers and script files for side to side moving and jumping. That way if you ever need to change one of those behaviours you have a specialized place to do it. Also, perhaps you have an enemy that moves side to side but doesn't jump. Or perhaps something that jumps but doesn't move. You could just drag the correct behaviour onto the game object.
as for animations, the unity learn tutorials are pretty helpful getting you started on animations and very basic state transitions
I'm in the midst of developing a kinect application.
Basically, what I have now is a simple WPF form with 3 buttons, a rightHand image and a leftHand image is tracked and is working.
I have 2 problems though.
1st Problem: Unable to move "hand" pointer to the extreme right and left.
I know this has something to do with bounding box and i'm still looking for a solution online.
2nd Problem: How do I initiate a "click" without making use of Kinect Region and the Kinect Tile Buttons? I'm looking for something similar to the video shown below
https://www.youtube.com/watch?v=d_UqFf4KYJA
If this is what you are looking for ?
X-box common gestures - Open the system menu
I think you have to use timer to check if the current positon is where you want it to be and start a counter for few secs.
Maybe this can help:
Hovering button
I have multiple videos in ScrollViewer and when I click on one of these videos It plays and I got movie on fullscreen and where I moved with scroll bar It's moving with videos. This is okay. I have implemented this by adding mouse click to media element and now I am testing this on touch screen and it's working.
But I want to differentiate between click on video and moving in that area. That user don't want to "select" video but he is just moving with area but not in scroll bar but in area with videos. For better understanding I added image:
To have WPF make difference between click and move (to have both but still calling just one). What is the best way to do this? Thanks
It is very hard to handle touch events on your own, especially when you have to handle nested controls.
I think the easiest way to solve this, is for you to use the Microsoft Surface Touch Pack
Replace your ScrollView with a SurfaceScrollView and place a transparent SurfaceButton above your MediaElements and react on the Click-event (or handle it via the a command).
This way, Microsoft does the tricky panning (scrolling) or tapping (clicking) for you. And as a nice side effect, you get things like bouncing and interia of the ScrollViewer for free.
I'm writing a hybrid XNA + Silverlight app for WP7 and I'm trying to work out the touch splitting between them. I've got this halfway worked out: I can suppress XNA TouchPanel touches when the user clicks a Silverlight button. However I have not figured out how to throw out game-only touches for Silverlight. So if you're holding a touch point in the game space (say, for moving the player around), a second touch on a button won't work. It think it's picking it up as a multi-touch gesture and only allowing the first touch point to click buttons.
My question is: how can you suppress this touch point in Silverlight processing?
The simplest way woudl be to design your app so that you don't use both types of control in an interactive way on the same page.
Or, if you must, when you detect the first XNA touch disable touch on the Silverlight controls.