Editor script that inspects an array in another script to present a choice on current script.

Kind of glossing over in and outs but here’s what I used as an editor script to look up a script in the inspector and recall values from an array for use in another script, to be fair, this would be only useful for making in house editor components or assets for others to use in the editor. but non the less:

You cannot cut and paste this script!!!!! It is for looking at the methodology…but it may help people who already now what there doing, to look up an array on another script and reflect the values in and inspector elsewhere.

Cheers Jon

By |February 27th, 2016|CodeBlog, Unity 3D|Comments Off on Editor script that inspects an array in another script to present a choice on current script.

Vuforia Copying Streaming Assets in Split APK OBB File

Continuing on from my previous post about splitting an Android APK in unity, you may find if you are using a plug-in such as Vuforia that certain assets need to be copied out from the streaming assets folder which has now become zipped/compressed and lies within the OBB extension file before certain processes can be started or called.

Based on my previous post we had a small script that lies in an empty scene this scene is the first scene to get loaded and then calls another scene which contains the main content of your application, this allows the split apk to only have a small app apk size and puts the rest of your app data into the obb extension part.

In this version we add an array of streaming asset file paths which on loading the attempts to find these files and copy them over to the persistent data folder, which works fine with vuforia 3.09 or up, as it also searches in the persistant data folder for images targets etc.

 

The code now looks like below:-

 

You may find if you are using any movie files from the streaming assets folder that in some of your scripts where the path was

streamingassetfolder/yourmovie.mp4

that you may want to correct the paths as below or in a similar fashion:

Hope that helps

Peel Interactive showcase in Wales

Its been great working with PEEL over the past year now, it great to see how things have come together, here’s a glowing review of their showcase exhibition in wales, earlier this month:-

http://ithinkoficarus.com/2014/10/14/the-reality-of-possibility/

By |October 20th, 2014|Blog, Events, Technology|Comments Off on Peel Interactive showcase in Wales

Vuforia, Unity and IOS8 troubles.

This applies from 01-09-2014 to the release date of a vuforia package possibly newer than version 3 to 3.0.10.

If using Qualcomm’s Vuforia plug-in for unity version 3 – 3.0.10 this is what I found was required for building, vuforia to date does not support IOS 8 SDK builds, but will play with retro IOS7.1 SDK build mode with the corrections described below:-

Use xcode 5.1.1 (min required to get a build to apple) don’t use xcode6 will not work unless you can get the ios7.1 sdk in there somehow. (download from dev tools member center, if you upgraded)

Don’t use latest unity 4.5.2 this has some great IOS 8 fixes (like fixes to stop native unity ios movie playback controls from showing, when specified) , but it screws with the vuforia stuff on IOS 8 platforms, it may work backwardly for IOS 6, IOS 7 builds (untested), but it does mess IOS 8 builds totally (qcar errors drop out straight away will not start).

Using Unity 4.3.1 (possibly some versions in between ) building to target IOS 6 (player settings) but building in xcode with latest IOS7 or 7.1 sdk (xcode settings), using Xcode 5.1.1,  works on IOS6 (possibly) IOS7 and IOS8 :-

IOS 6 and 7 devices should just work bar a vuforia media plugin playback issue on 64bits Iphone5s and Iphone6, and supposedly 64bit pads running ios7, the requirment if using that movie texture method is to keep them all at exactly 640px x 480px, with default mp4 base layer settings, anything else to knowledge will help crash a 64bit device.

IOS 8, will work when built with IOS7.1SDK (as described above) however, when you first access a scene with qcar, it will trigger a ask for camera use […]

By |October 11th, 2014|Unity 3D|Comments Off on Vuforia, Unity and IOS8 troubles.

Scaling part of an image to fit a desired rectangle with overflow

rectanglecopyimage2fill

 

 

 

 

 

 

 

Here’s the deal where this maths helps:-

Lets say I have a large image or webcam view, and can find a face in it and have the x,y,width,height rectangle coordinates for that face in that image, and I want to take that face and make it fit a template (fit in another rectangle in a second image).

Simply just copy the rectangle pixels from image 1 and paste it to the new rectangle in image 2, right..

however what if I want to take some of the image surrounding the face so I can use a feathered mask on image 2 as such, i.e. image 2 is 512px x 512px and I want the face to go into a rectangle somewhere in the lower middle of this second image, but wish fill the entire of image2 with available data (obviously if the face is right at the border of an image some will be left blank).

Well the below helped me with some javascript I was doing with canvas and webcams etc, but is applicable across the board hence the maths section. Firstly I found this:-

So taking that I created this code, javascript/pseudocode.

 

Hope that helps with someone’s brain mangling, if indeed you stumble across this page.

By |October 11th, 2014|Math|Comments Off on Scaling part of an image to fit a desired rectangle with overflow