Is it possible to control the camera in a Unity3D project being played on the Web player?
I want to control the walk through of existing models using JavaScript in the web player.
I see they have API functions for calling internal functions defined within the script, but don't see any way to gain access to the camera.
By API, I assume you mean the SendMessage approach outlined in the documentation. That is indeed the best way to approach this. Write a script which controls your camera, expose functions you can call, and call those using the
function ControlCamera()
{
u.getUnity().SendMessage("MyCamera", "Control", "");
}
approach.
Other than that, to the best of my knowledge, there is no real exposure of a full API that lets you control GameObjects or components attached to them from JavaScript in the manner you seem to be requesting.
Related
I want to add the custom data to the Mapbox in Unity.
Unity version: 2020.3.36f1
Scripting Runtime Version: vsCode
Api Compatibility Level: NET4.0
Mapbox SDK version: 2.0.0
The platform I am building to: Android, IOS.
I want to change the colors of the buildings according to the some states of custom data in Mapbox.
However, the custom data is the response from my Api server(NodeJs).
The flow is as like below;
When the scene starts, I send the ids of buildings(Gameobject names in Unity scene) as request parameter to the api server.
The server sends the data of the buildings to Unity.
So, I display the colors of the buildings according to this data in scene.
But, the problem is how to know when the all buildings of the scene are loaded.
Once all buildings are loaded, I can get all names of the buildings.
I used OnUpdated event, but I can't get the names.
I had a similar issue trying to access the terrain elevation data on OnUpdated, but it seems that it is not necessarily available at the time when OnUpdated is dispatched. You would think that when OnUpdated is dispatched, all processes related to the map updating are done, but, apparently, that is not the case.
I solved it in somewhat hacky way by using the OnTileFinished event, which will be dispatched for each loaded tile whenever it is done with it's processing. At least it seems that I can rely on the terrain data (for the given tile) being loaded at that time, so I would guess that the building data (for the given tile) would also be loaded.
It would be nice with some built in event when all tiles are finished, but I haven't been able to find such an event. I initially assumed that the OnUpdated would be such an event - the name sort of suggests it - but it doesn't seem to be so. Maybe it is a bug in the MapBox code - I don't know.
Unfortunately, it seems a bit like MapBox has stopped developing and maintaining the Unity SDK, the latest commit is from February 2020, but maybe they will get back to it at some point.
I'm new for unity.. In my project I have a function that indicate Interior designing using Augment reality.. The thing is the designer can be able to upload their designed interior design in to our app, for this I need some help, When I refer the internet I got the information about 'online Directory' (For store the asset in to that, then he can upload that), I don't know whether it will be useful or not, Can any one please suggest a solution for this scenario?
First of all it is important to know that the user can not send a 3D model (.FBX) to the app. You can only use existing models within Unity 3D.
If you want the user to download new 3D models, you can use AssetBundles.
If you want the user to create a decoration and share it with friends, you should create a JSON / XML with all objects and positions and save it to your database. When another user requests this file, it will be downloaded and the objects will be dynamically created in a scene for the user to admire all 3D objects.
Can I to open a MKMapView with directions from multiple places. I do not want to call the google maps api where it will open is a separate window. I want to place info on the stops if possible.
Sure you can.
My suggested starting sequence for achieving this is:
Read up on MKOverlay, MKOverlayPathView and related MapKit classes.
Fetch the directions in a background thread from a provider (eg Google API). This doesn't open in a separate window, you can do it all in background with some API calls. Parse the results into a local model for your stops.
Show your map view, and generate overlays from your directions model data.
You'll add Annotations for your stops, and they will have "callouts" so that the users can view some details about them. I believe there are plenty of examples readily available that demonstrate how to do this.
I hope this very general answer is of some use, perhaps just to let you know that what you want to do is readily achievable, and doesn't require much code.
you can request directions from one of the APIs available (Google,...), parse them and draw them as overlay on your MapView, but I recently stumbled over a commercial framework which saved me a lot of time and hassle:
http://mtdirectionsk.it
My app uploads an image and stores the image info in the database. If needed it manipulates the image. There are several points in the site where images can be managed like this.
In each case I have an action imageuploadAction() that handles things. Because I have slightly different requirements depending on the part of the site the image is going to be used in there are several different imageuploadActions in various controllers of the site. I want to combine them all into one, however, to make the app easier to manage.
So, my question is what is the best way to handle a site wide image upload capability within Zend Framework? I feel it must either be:
Have one action that does it all and the various controllers would use that action, or...
Create some sort of plugin that does it. An Action Helper Plugin perhaps? Maybe a controller plugin of some sort? What sort of plugin is the best way to do this?
I'm inclined to think 2 is the way to go but want your feedback on this. Thanks!
Oh, and the plugin (or action) will handle physically uploading the photos, categorizing them, flagging them for various uses, resizing as needed, passing data to the DB for all CRUD actions as necessary, etc. etc.
What you are describing is what action helpers were designed for, so I'd suggest creating an action helper for handling uploads and moving as much of your processing code into that as possible. However you still need to call that helper from your controllers, so then it really comes down to what suits your application - a central controller that handles the uploads (by calling your helper) or calling the helper from the relevant points in your existing controller methods.
If you can get to a point where your image upload actions are as simple as this:
public function imageuploadAction()
{
if ($this->_helper->HandleImageUpload([...])) {
[...]
}
}
then I'd say you're in pretty good shape, and you can always reuse the helper elsewhere if any parts of your app need to handle an image upload and some other data in the form at the same time.
MapKit doesn't natively support local search results, so I'm looking for a way to get a list of local pizzerias (or coffee shops, or a specific retailer) via some http api call.
The default google maps api requires javascript, so it's not clear to me how to integrate this into an iPhone app (without displaying a UIWebView).
I have found that a url in a format such as this:
http://maps.google.com/maps?output=json&q=pizza&near=37.3,-122&num=10
Does return a JSON-like list of results, but my usual friendly JSON parser, json-framework, barfs when it tries to parse this (even if I do clever-sounding things like leaving out the "while(1);" at the start of the reply). I'm also not sure how legitimate this URL is to use for this purpose.
I'm on the same quest. It seems that one option would be to perform the local search using Google's AJAX Search API, then plug that data into the mapkit.
That said, it's not entirely clear to me yet that this approach is in the clear vis a vis google's terms of service. Let's see here. Alright, changed my mind because of this. It's a post on google's own ajax api blog including video of a native iPhone app. Looks like this is the approved solution.