How to use Screen Tap to place 3d object on a plane in Spark AR Studio? - spark-ar-studio

I want to use Screen Tap patch in Spark AR Studio to place an object somewhere on 3d plane created by Plane Tracker.
There is Move and Resize an Object in the World tutorial on the official site and it mentions Screen Tap in the intro section, but later it elaborates only on Screen Pan, Screen Pinch and Screen Rotate.
But I want user to tap to place. Is that possible?

Yes, there is an onTap gesture method available on the TouchGestures module see here: https://sparkar.facebook.com/ar-studio/learn/reference/classes/touchgesturesmodule/
The code would be like this:
TouchGestures.onTap().subscribe((gesture) => {
planeTracker.trackPoint(gesture.location);
});

Now there is even simpler solution if anyone, like me has the same issue in 2022 and beyound. You just need to drag and drop planeTracker to the Patch Editor to get planeTracker patch to which you can connect Screen Tap patch: Gesture State output to Set Tracker and 2D position output to Screen Position input.

Related

Tiled map not rendered fully

I'm using cocos2d-x 3.17. When I run a Follow action on a sprite, the tiled map can't render fully. The map looks exactly the same as the screen record shows in posts below
https://discuss.cocos2d-x.org/t/1-5b2-tiled-map-not-rendered-fully/36661
https://discuss.cocos2d-x.org/t/solved-tilemap-rotation-clipping/37114
But they were using Cocos Creator and can fix it by setting ENABLE_TILEDMAP_CULLING = false.
Is there any equivalent settings in C++ api?
Found out the root cause is that the Scene has been moved by Follow action. It seems in cocos2d-x, Scene is not supposed to move.

How to get the current position of my screen in Cocos2d?

I'm doing a platformer game using cocos2d-x v3 in c++, where the maps are usually very large, the visible screen follows the object through the map but I can't find a way to get the position of the visible screen in the map.
Using Size visibleSize = Director::getInstance()->getVisibleSize();gives me the dimensions of the entire map.
Let's say I want to show a sprite in the top right corner os the screen whenever the object reaches a point in the map, and this sprite would be always in the top right corner os the screen.
Using the object position doesn't do it.
Is there a way to get the position of the current screen?
Or is there a way to show a sprite or whatever in the screen and it would be in the screen even when the screen is moving?
Ps. I'm super noob in game development
There is a simple resolution:
You need two layer:
1: gamelayer
2: uilayer
Gamelayer is the one which you can move.Your map is added on gamelayer and when you need move the map you can just move the gamelayer.
Uilayer doesnt't move and its zorder is larger than the gamelayer.The sprite that shuold be always in the top right corner of the screen is on this layer.
Also:
There is a more complicated way:
You doesn't need to move the gamelayer.Just bind a camera to gamelayer and bind another camera to uilayer.
When you need to see the rest of your big map,you just move the camera of the gamelayer where you want.
BTW:
This is my first answer on stackoverflow.
English is not my first language,not very fluent.
Hope this can help you :)
I answered this question for you, which is a duplicate of the current question. The exact same solution applies to both situations. Add your sprite to the HudLayer as described in this question.

Adobe Air - Starling/Features | Controls and device simulator

I have few questions here, regarding creating app in Adobe Air using Starling and feathers.
I created yet a very simple app, which has Feathers list controller with static data provided to its dataProvider. According to the code it should work fine, but there are three major issues I am facing.
1: Touch/Click Positions
I am using:
list.addEventListener( Event.CHANGE, list_changeHandler );
Now the problem is, clicking coordinates are not correct. Clicking on 3rd Item triggered 4th item, to trigger 3rd, 2nd item needs to be clicked it's half way through etc.
2: Nothing, without Theme
I am using a custom theme, came along with a tutorial. If I don't use the theme, I am unable to see anything on the screen, somehow.
3: Resolution (Device Simulator) Problem
Though buggy, but it works with Theme, but my app doesn't fit with the resolution for each device simulator. Either its, iPad or iPhone 4 or any android simulator.
Also, can anyone please also explains, what is significance and use of Context3D render mode in starling class.
Any help is appreciated:
Thanks in advance
Waqar Iqbal
Starling is a Stage3D framework that displays content directly on graphic card using Context3D. Everything displayed by Starling is always under the regular display list. Feather is a component framework based on Starling.
Stage3D cannot handle any mouse operations so Starling and Feather simulate all their mouse event (those mouse event never really happen anywhere, they are created by calculation of mouse position on the stage)
not sure, never used Feather
Starling does not handle screen density and dpi calculation, if you want your app to fit any screen you'll have to handle it yourself.
I think you should see the example carefully. if u want to use any feathers component either you have to use feathers theme or custom theme.
if you use feather theme you need to provide theme path and before using any component you need to initialize that theme.Then use component any where.without theme you will not see any thing.
1: Touch/Click Positions
please provide minTouchHeight in class theme of DefaultListItemRenderer like:-
renderer.minWidth = this.gridSize;
renderer.minHeight = this.gridSize;
renderer.minTouchWidth = this.gridSize;
renderer.minTouchHeight = this.gridSize;
2: Nothing, without Theme,
3: Resolution (Device Simulator) Problem
Follow the example given in feather library
feathers-2.1.1\themes\MetalWorksMobileTheme\source\feathers\themes

Google Maps IOS SDK 1.2 need snapshot of map view

In 1.1, the GMSScreenshot class provided a rudimentary way to get a snapshot of the entire screen into a UIImage. In 1.2, the class is missing, and in the release notes, it says this:
Calling renderInContext: on the GMSMapView layer now renders correctly;
this allows for snapshots and UI effects
Unfortunately, I'm not finding this to be the case. Typically renderInContext: does not work on Open GL drawing, but I figured I'd take a shot anyway (it didn't work). Has anyone been successful in getting a (preferred) view or screen snapshot?
I am able to take a screenshot. Here is the code I use:
UIGraphicsBeginImageContext(mapView_.frame.size);
[mapView_.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShotImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
I do not call this straight after I create the map as it can take some frames for the map to render.

Are there any libraries providing mouse-driven zoom/pan for pure AS3 projects?

Today I wanted to add mouse-driven zoom and pan functionality to a pure AS3 project - something like the Google Maps interface. I was surprised that I couldn't find a good package or library to do this already - I'm using FlashDevelop rather than Flash CS3, so the nice VCam tool available as an FLA is no use.
There's nothing very complicated involved in implementing zoom/pan, although it can be fiddly and time-consuming to get right, but since zooming and panning are pretty common things to want to do I wondered if anyone could suggest a 'correct' way to do this in the Flash world, or a good library available that I haven't been able to find.
I found exactly what I was looking for in the flare library's PanZoomControl:
Interactive control for panning and
zooming a "camera". Any sprite can be
treated as a camera onto its drawing
content and display list children. To pan and zoom
over a collection of objects, simply
add a PanZoomControl for the sprite
holding the collection.
var s:Sprite; // a sprite holding a collection of items
new PanZoomControl().attach(s); // attach pan and zoom controls to the sprite
The mouse controls are also implemented as you'd expect:
Once a PanZoomControl has been
created, panning is performed by
clicking and dragging. Zooming is
performed either by scrolling the
mouse wheel or by clicking and
dragging vertically while the control
key is pressed.
You could use a 3D library such as Papervision3D or FIVe3D. Then just move your camera based on different mouse events/gestures. Or use the built in z-axis in FlashPlayer 10 to get the zoom effect.