I have a .obj file that has a 3D body in it and I want to render it in a Xamarin.Forms app that already exists(made with MvvmCross), so I just want to create a new ContentPage that has the rendered body. The user should be able to view the body from different perspectives and maybe click on it to highlight some parts, but that's it.
I found out about UrhoSharp and I also know that I can use Metal and Vulkan bindings for Xamarin, but as I'm a beginner in 3D apps I don't know which one would be best for my scenario, that's why I would like someone to point me in the right direction for this scenario. For UrhoSharp I found this loader which only works on Windows 10, the Android app doesn't load anything and the iOS app renders the body but I can't move the camera around it.
Xamarin forms is good for making apps that are like "Forms" in which you fill out some information and submit.
The best way to do more 3D work is using Xamarin Native, Unity or if you want it to be a small part of your Xamarin Forms app, you can simply create a Custom 3D Renderer in Xamarin Forms.
The beauty of Xamarin is that you can access all the native APIs, so you would just follow tutorials on using the native APIs to access those OBJ files. For iOS, you would just be looking for a tutorial on how to use ARKit and then make small tweaks to add the obj file like this.
Do the same thing for android!
Related
I'm designing an AR andorid application with Vufoira and Unity.Then; I want to add components like side bars in the camera view(Vuforia Scenes). But since I'm new on unity i don't know how to achieve since UI elements in Unity are pretty tough for me.
I bought this component to design easier my App views and also has build-ed views which you can modify quickly.Even though, Adding side bars on the camera views seems to be hard.
UI builder
Any advice,tutorials you can give me on programming android events for achieving side Bar effects in Unity i'd be great.
There is no way to use Android or iOS UI element directly in an Unity game/project. Unity has his own GUI abstraction, so you don't have worry about the code for a button in Android, iOS or PC game.
GUI in Unity (since Unity 5) are basically images that simulates buttons, bars, menus, etc... so, you can create beautiful ui if you have nice design skills.
If you wanna use Android style gui elements you must create every image that represent that component and you must create the code to achieve the behavior desired (so, this could be hard to complex android gui component like tabLayout o NavigationDrawer).
I found a project from a person who wants use iOS gui elements in unity, so he created the images and code for each component, still in beta but works nice for me:
https://forum.unity3d.com/threads/released-ios-for-unity-ui-ios-user-interface-design-for-unity.282399/
I am new to Xamarin, and am setting up a Xamarin Forms app, and triggering the device's camera after creating the intent and starting an activity for it.
Pretty much what Xamarin's recipe looks like, but I am using Forms.Context as the Activity object (in order to place all the hookings inside my content page, as opposed to having everything within MainActivity.cs, as in Xamarin's recipe).
It works, the camera is opened.
Intent intent = new Intent(MediaStore.ActionImageCapture);
_file = new File(_dir, String.Format("myPhoto_{0}.jpg", Guid.NewGuid()));
intent.PutExtra(MediaStore.ExtraOutput, Uri.FromFile(_file));
Forms.Context.StartActivity(intent, Bundle.Empty);
The thing is I want the same as the recipe's feature of putting the picture just taken into an ImageView.
The recipe's code generates the UI (and everything else) within MainActivity.cs. I wanted to keep the view declared separately, in its XAML file.
As far as I understand, I need to be able to embed a axml android resource file into the xaml, because code in MainActivity is already Android-ported, and Android can reference views/controls only by their resource id (which are automatically generated after creating the view/ui container as an axml file under Resources/layout folder.
How do I complete this last step in order to have the Take a Picture sample working - coded outside the MainActivity?
Screenshots:
Here's how the Xamarin recipe puts the picture taken into the image viewer.
if you are working with Xamarin Forms and want to take a picture and then display it with an Image - I suggest you use https://github.com/jamesmontemagno/MediaPlugin which allows to let the user take a photo (or pick one from the phone). The result can be set as the ImageSource of an Image.
About the original question, whether you can embedd a native android element into xamarin Forms - you can check out https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/add-platform-controls/
I think the right way to deal this is to use DependencyService to access Android native feature, to be specific here, to call the native method of taking a picture and save the picture. If you just want take a picture and display it with Image, you can use DependencyService to implement this platform specific feature and design your layout in xaml, there is no need to embed axml in XAML.
If you want to embed the camera preview in Xaml, the suggested way is to use Custom Renderers to render the interface using the native controls of target platform. It means, you don't need to create a axml in Android project to display camera preview, you can create a custom renderer (control/ view) in PCL, and implement this control in your Android project. There is official doc and demo which guides us to implement a view to display the camera preview.
I see there is an iOS and iPad, PIN Code Control xamarin component, that will give your a programmatic numeric keypad for PIN Entry. Short of coding the entire thing using C# in Xamarin I would prefer to find a component.
I need a PIN code control, xamarin component that is cross platform, which is the purpose of xamarin forms. We will be using this on Android and iOS devices.
Has anyone see such a component on Xamarin's Component Store and I am using the wrong search terms, PIN, Keypad, Numeric?
For future googlers: you might be interested in a small Xamarin.Forms library XamarinFormsPinView. I'm the author.
It's not very configurable, but should fill most common requirements.
Sorry, I have not seen a component that does what you need.
This Xamarin.Forms calculator sample might be a useful starting point for writing a custom one (since it already implements a numeric keyboard entry with display and backspace).
Obviously there's a lot of styling work required to get it looking like any of the native PIN entry screens - but it should save you writing from scratch.
If you need attractive xamarin forms pin passcode form with high control, check out this repo. It is not a library and it does not use MVVM models. It is just .XAML page with code behind it.
https://github.com/Akezh/XamarinFormsPinPassword
I've just started looking at how I can generate and port applications to Android and IOS, I've started to look at Xamarin. First, I'm looking to generate custom UI control of a 10x10 Matrix (checkerboard - each square is a different colour) with each square being able to be selected and a specific image being displayed.
After looking at the documents and looking at MVVM examples, I'm not entirely sure what the best method of doing this : How should I structure the code (should I use just SVG drawing) or is there a better method of doing this in Android and IOS ?
To be honest I would start with Xamarin Forms and create a grid control with 10x10 image buttons. This way you get the event handling built-in. This would work for iOS, Android & Windows Phone out of the box. From there you could evolve it to more native specific code if necessary.
If you want to control the look pixel perfect then creating native custom rendered views would be the option but this is much more work of course so I would not start there. On Android you would subclass from Android.Widget.View and on iOS you would do it from MonoTouch.UIKit.UIView. For both you would override the Draw method.
I'm new to XNA, however I managed to develop a pac man game. Now I'm trying to add some forms to the game to be used as a log in screen,but due to being an XNA project I can't add pictures to the form, any help pls?
Thx for your time
XNA doesn't work like WinForms, it isn't a GUI editor. Like you said, you can't add windows controls to a XNA application (unless you use a workaround, but that's not necessary for a login screen)
You'll need to use Game States to determine what to draw/update based on which menu you're currently in. The APP Hub has an example for that.