Ok I have a plane tracker where I manipulate the position via screen pan but also want to set the position of the plane with screen tap. You cant have multiple nodes set the position of an object, so I have a null object as the child of the plane tracker.
Because I move the plane tracker with screen tap and the null object with screen pan, I need to reset the null object to (0,0,0) every time I screen tap, else the null object's local position is way off. I tried doing that with a pulse, but it does not work:
Is there a way to have a plane tracker's position set with screen pan AND screen tap?
You don't need any nullObject here! Just use this graph to get pan/tap at the same time.
Related
I've created an animation for a Panel element in Unity. After that, I've moved the element from its original position.
Furthermore, this element is anchored to the bottom of the screen in order to stay there whichever the screen size is.
The problem is that the moment I hit Play to debug, my element suddenly moves to another position, which I believe is the original position where it was when I created the animation.
I may be able to create the animation again. However, this would not solve the problem since a different screen resolution would make a slight change to the position, and therefore the desired position for the element to be would be changed again because of the animation.
Can't I create an animation independent from position? In positive case, how? In negative case, how could I address this problem?
What you have to do is to make animation relative to a parent object. Put Animator on the Panel's parent, animate its child transform and voila - animation is now always played relative to the Panel's parent position.
https://www.highwaynorth.com/blogs/bryan/relative-position-animation-in-unity
I'm working on a project where we need to create Search Rings. These are defined as a lat-long/radius, overlaid on a map of the Continental USA.
The desired implementation is a marker, useful for close positioning of the lat-long (or even updating, via popup + jQuery) with an "attached" circle.
Desired behavior:
when the marker is moved, the circle is dragged with it, and repositions itself with its center coincident with the marker's position (this is completed)
the circle's edge? may be gripped and resized, thus changing its radius.
Current issue: when a L.Circle is marked editable, it's both resizeable and directly movable. This is apparent by the gripper boxes on the outside of the circle together with the box at the center of the circle. How do I disable/hide that center gripper?
As always, thanks in advance.
I have a 2d scene with a camera set to the default distance of -100. If I add a canvas it for some reason has a default plane distance of 100 (not sure why as surely this would place it behind the scene?) and set to Screen-Space Camera.
The oddness happens when I add UI elements. For instance if I add a button, I first have to set its z position to at least -65 (Again I have no idea why) or it does not show in the editor. But if I run the game the Text does not show. Now if I delete the button element and instead first add another element (can be anything but lets just say it is a text element) then I add a button element. They are both not visible until I set one of their z positions to -65 or greater. Now that is strange enough but now if I run the game the element which is set to -65 is not visible but the one set to z position 0 is showing correctly...... now if I swap their z positions and run the game the one that was visible is now hidden and the other is now visible.......
What on earth is going on?
Note if I set the canvas to screen space overlay everything works fine without any messing about but the canvas looks tiny in the editor and is about 1/8th the size of the scene while being off centre and not resizeable or re-positionable..... When the game runs it is fine though and fills the screen (again I have not idea why this is).
Note my camera is set to a size of 540 in order to lock it to 1080p
I want to pin my mouse in middle of screen I mean when user move mouse the only thing that he see is rotation in environment also mouse cursor never reach window border ...
I want to handle my camera with mouse but when mouse reach window border or in full screen mode screen border the mouse position doesn't change but camera should still rotate slow or speedy depend on speed of mouse movement...
How should I solve this problem?
SDL_warpmouse can accomplish this. If you are looking for an OS-specific way to accomplish this, consider viewing SDL's source code.
I need guidance towards the right direction to take here.
I want to build a spinning wheel control where a user can select an element.
I want to accomplish the following:
Receive touch events that will rotate the wheel based on the finger position in touchesMoved
Magnify the image that is inside the selected image indicator when it passes through.
I was thinking of a core animation Basic Animation and animating the rotation.
Using an animation group and rotate it around.
Problem 1:
How do I sync the animation to the touch events.
Problem 2:
How will I know which image is the one I need to magnify with for example an CGAffineTransformMakeScale.
Is there a best practice for my problem. Esp. with performance in mind?
http://img24.imageshack.us/img24/8596/imagezy.png
You can achieve this by update the wheel for every touchmoved event.
For each touchmoved, touchbegin event, you can know the angle of the line from center of the wheel to your finger. You save your begin angle, then you will know the diff angle. The wheel can rotate depends on your finger by using angle.
you can enlarge the image icon by either of these two ways.
1. You can know which image icon angle in all the wheel, and you also know current angle of the wheel. So, if the image icon is between the right angle. Ex. if wheel is at 45 degree, then icon at -45 or 360-45 degree will be enlarged.
2. check the y origin of each image icon, if the image icon origin y is above threshold.