How to specifically scale model using pinch gesture in either lengthwise of bredthwise? - arcore

i have a model. i want to just scale in up or down lengthwise rather than in every axes.
How can i tweak into
scaleController and pinch gesture to do this??

you can make use of the - public class TransformableNode
Node that can be selected, translated, rotated, and scaled using gestures from TransformationSystem.
Pl. refer to the google developer link which explains how to use these API's
https://developers.google.com/ar/reference/java/sceneform/reference/com/google/ar/sceneform/ux/TransformableNode

Related

Best approach for user-placeable custom UIViews?

I'm consider the following usage scenario:
The user adds a new shape to a page
He or she places the shape freely on the current view (e.g. using a pan gesture)
Also, the user can resize the shape (e.g. using a pinch gesture on it)
The shape snaps to already existing shapes on the drawing
Implementation details: A page is a custom UIView. The user can add as many shapes as he or she likes. Shapes are instances of different custom UIViews which needs to adapt their content to the new size (see step 3). Overlapping shapes are not possible. And the user must be able to select shapes for operations like "remove".
Question:
I could simply instantiate the shape UIViews and add them as subview to the page UIView. But then I would need to implement all the details like tracking touches to move UIViews to new positions, running the collision detection, handle resize and so on.
Are there controls/classes/... in UIKit, CoreGraphics or the like available which would make my life easier?
I found UIDynamicBehaviors in UIKit. Would this is be way to go or would you suggest a different approach?
Thanks a lot in advance!
Cheers,
Chris

tracking camera's position and rotation

I have allowsCameraControl property set to true. I need my camera to tell me what it's position and rotation is, while I move it around with pinch and pan gestures so I can later update my camera to that position. Is there some function that is called every rendering moment so I can put println: statement in it? The other option I could think was to set a didSet statement at camera's position and rotation property but I have no idea how to do that if I'm not the one defining the property in the first place.
Found a way around it using custom buttons(moveLeft,moveRight,rotateLeft etc..) to move the camera(and report current position) around 3D space. Works great. Can't tell if mnuages's suggestion works, but it looks allright.
you can use delegation methods such as SCNSceneRendererDelegate's -renderer:didRenderScene:atTime: and you can access the "free" camera by using the view's pointOfView.

Advanced custom control features in Swift

I'm working on building a custom control. Basically I want to allow the application to generate rectangles (positioned at x = 0 with a variable y value that increases as each rectangle is added).
I'd like them to respond to gestures where they have two positions (closed - which mostly hidden, open - expanded fully so that the entire rectangle is still visible but tethered to the side).
I've already designed an application with this in mind. Seeing as the rectangles will be generated by the users, I assume core graphics would be best for the job. Also, I want the rectangles to display different information based on their gesture-related position.
Is it possible to combine core graphics with these types of controls? I know this is asking a lot.
It's just that I'm having trouble determining how to combine each component in code.
Any advice would be greatly appreciated. Thanks!
Clearly, we're not here to write code for you, but a few thoughts:
You say that you assume Core Graphics would be best for the job. You definitely could, but you could also use CAShapeLayer, too.
So you might create a gesture recognizer whose handler:
Creates a CAShapeLayer when the gesture's state is UIGestureStateBegan and adds it as a sublayer of the view's layer.
Replace that shape layer's path property with the CGPath of a UIBezierPath which is created on the basis of updated location that the gesture recognizer handler captures when the gesture's state is UIGestureStateChanged.
I'd suggest you take a crack at that (googling "CAShapeLayer tutorial" or "UIPanGestureRecognizer example" or what have you, if any of these concepts are unfamiliar).
If you really want to use Core Graphics, you would have a custom UIView subclass whose drawRect draws all of the rectangles. Conceptually it's very similar to the above, but you have to also writing your own rectangle drawing code that you'll put in drawRect, rather than letting CAShapeLayer do that for you.

Drawing World Map - Performance & Interaction - iOS

I’d like to use a Shapefile to generate an interactive world map. I was able to import the data and use CG Paths to draw the map into one large view.
The map needs to support panning, zooming and touch interaction. For that, I've created a UIScrollView and placed the MapView (large view with all of the countries drawn) into it.
I need to improve two aspects of it:
Performance / rendering
I have drawn the map much larger than the screen size, in order to make it look reasonable when I zoom in. There are a few problems with this. First, when I'm zoomed out, I need the border stroke/line to be wider so they are visible. When I zoom in, I'd like the stroke to be a thinner. Also, when I zoom in, I can still see that the map is a blurry. I don't want to increase the view size too much.
How can I make the map look crisp when I'm zoomed in? I attempted to redraw the map on zoom in, but it takes far too long. Can I somehow only re render onscreen stuff?
Touch Interaction
I need to be able to have a touch event for every different country.
Possible approach?
I was thinking of trying to separate every country onto it’s own view. That should make touches easy to handle. Then I’m thinking I can possibly redraw the appropriate views that are on screen/zoomed to.
I've played with an app that does something similar ("World Maps"), and I can see that when you pan or zoom, the map is blurry for a second but then becomes clear. What is going on there?
use mapkit and provide custom tiles. dont reinvent the wheel and try to write yet another map framework
I think that you have to create different scaled area image from the big map image. how to say... imagine the google map, how it works... I think that provide many different zoom factor image for every area of the world... then merged display on the screen while user need show it ...
use code implemented the map effect is impossible on current iPhone device, out of the ability of the iOS device

Triangular shaped buttons for iOS

I have created a scoring system for iPad for darts (501, 701 etc) which works nicely and you can select the score that you hit using a list (20, Triples, Doubles) etc and all is working fine but I wanted to rather make it that you have an image of a dart board and simply touch the part of the board that you want to log the score.
Is it possible to have one large image of the dart board and have "hot spots", much like an HTML image map or would it be better to create a custom button for each selectable area?
Would Cocos2d be better for this system?
Many thanks for any advice on how to best to proceed.
John
You can create an image of a dartboard, and add a tap gesture recognizer to it. Rather than defining "hot spots", you would use the recognizer's locationInView property to get the location of the tap, and use some trigonometry to figure out what "pie slice" the touch was in.

Resources