Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - William Ravaine

Pages: [1] 2 3 ... 44
Support / Re: Error message in Unity5
« on: 15 December, 2014, 12:36:42 PM »
Thanks, I will take a pass at Unity5/Unity4.6 support today and fix these small glitches.

Support / Re: Swipe between levels
« on: 02 June, 2014, 06:49:41 PM »
Hey greg,

I've done something similar for a project of mine. I made a simple system where each page is a GameObject where its children represent that page's content. You can have as many things as you want in there. When you load a page, you simply deactivate or remove the previous page, and activate/instantiate the new one. If you have a lot of content per page (lots of different textures, animations, sounds, etc) then you may want to dynamically load these pages instead, by putting the pages prefabs in a Resources folder and loading them on demand at runtime using Unity's Resources.Load() API.

Your "Book" or "PageManager" component is the one that should register and react to to the swipe events, and manage the setting/changing of the current page.

Support / Re: e.Position returns wrong position
« on: 01 June, 2014, 05:02:38 PM »
Hi deedsol,

e.Position is the screen space position, that is, where the finger/gesture happened on the screen. If you want the world space position, you need to hook up a ScreenRaycaster component, which will perform a raycast into the world. You can then access the raycast hit information via e.Raycast.Hit3D.point or e.Raycast.Hit2d.point, depending on whether you're using 3D or 2D raycasts.

Support / Re: TBPinchZoom - Can't Move Transform of Camera
« on: 30 May, 2014, 11:55:56 AM »
Hi oliver,
Sorry for the delay in replying :(

There are two ways (zoomMethod property) that the TBPinchZoom can generate the zoom effect:
- Position: will physically move your camera forward/backward based on zoom level
- FOV: will adjust your camera's field of view based on zoom level

When the TBPinchZoom component is active, it will set the correct position and/or FOV value on each frame, overriding any other value set by other scripts before it. That's probably what you are noticing here. My guess is you have the ZoomMethod set to Position and it's taking control of your camera transform. If you change it to the FOV zoomMethod, this won't happen.

To be honnest, the TBPinchZoom needs a big redesign on my part to make it a more well behaved citizen. It was more originally more meant as a sample script...

Support / Re: Drag velocity
« on: 30 May, 2014, 11:48:09 AM »
Hi ElKrullo!
When you say it doesn't work, what's happening exactly? Are you getting an incorrect value?

Support / Re: Swipe between levels
« on: 30 May, 2014, 11:42:48 AM »
Hello there,

I agree with ElKrullo, I don't think changing scenes is the best way to do this. You'd be better off creating a prefab of each page in the same scene, and then having a "page manager" component that is in charge of managing the transition between pages, taking care of effects, deactivating the current page and activating the new page.

If there are too many pages or the per-page content is too heavy to have all of them fit in memory, then you could also load them dynamically by putting each individual page in a Resources folder and using Unity's Resources.Load() API to load/unload the pages you need.

Are you having troubles with detecting the actual swipe?

At the moment there is no support for "resetting" the GestureRecognizerDelegate; this means it can only be stateless. One workaround that I can think of is to track the object that each finger started above and use this data in the GestureRecognizerDelegate.CanBegin() method to prevent the gesture from being processed.

The FingerGestures.Finger object has an "ExtendedProperties" key/values dictionary field that you can use to store any extra per-finger data that you might find useful. You could add an entry in there to keep track of the object the finger started on and look it up in CanBegin().

Support / Re: Smooth motion on rotating 3D object
« on: 30 May, 2014, 11:24:26 AM »
Hi Tripwire, so sorry about the big delay :(

You should be able to use the technique I described in my first answer to achieve what you're describing. In your OnDrag event, you would simply update the IdealYaw of the cube/human:

void OnDrag(DragGesture gesture)
        Human.IdealYaw = gesture.DeltaMove.x * Time.deltaTime * speed;

Then you let the "smooth rotation" component on the Human object take care of performing the actual rotation. If you want tighter control while dragging, you could set the SmoothSpeed to a really high value, and set it back to a lower value when the drag is over, to give that inertia effect on release.

Please let me know if you need more help/explanations on this.

Support / Re: Windows Phone 8 building issue
« on: 30 May, 2014, 09:57:33 AM »
Hm FG indeed uses both a non-generic "FingerEventDetector" class and a generic version "FingerEventDetector<>". As a quick fix, you could rename the generic class to GenericFingerEventDetector<> in FingerEventDetector.cs. I will include this change in the next build too.

Support / Re: Convert method help...
« on: 30 May, 2014, 09:50:16 AM »
Hi Jams,
There is a doc page on this topic at, have you had a chance to look at it yet?

The swipe gesture Velocity property is given in pixels per second, so if you want it in a DPI-independent form, you should convert it to centimeters instead. It's very easy to do with the built-in extension methods added to any float values:

Code: [Select]
float velocityInPixelPerSecond = swipeGesture.Velocity;
float velocityInCentimeters = velocityInPixelPerSecond.Centimeters(); // convert pixel -> cm

The force you then apply to your football should be proportional to velocityInCentimeters. This will ensure the force applied is roughly equivalent regardless of what type of device your user is on.

Support / Re: Smooth motion on rotating 3D object
« on: 12 April, 2014, 01:19:31 PM »
Hi Tripwire,

To implement basic smoothing, I usually have an "ideal" and "current" value, and interpolate the current value toward the ideal value over time. With rotations, you can also use spherical linear interpolation ("slerp") on quaternions which gives a nice shortest-path rotation smoothing:

Here's an example:
public float IdealYaw = 30;
public float SmoothSpeed = 5;

void Update()
   Quaternion idealRotation = Quaternion.Euler( 0, IdealYaw, 0 );

   // smooth the rotation
   float t = Time.deltaTime * SmoothSpeed;
   transform.rotation = Quaternion.Slerp( transform.rotation, idealRotation, t);

The trick is in the "t" parameter that controls how fast we move from the current value to the ideal value.

Does that help?

Support / Away until April 1st 2014
« on: 26 March, 2014, 11:44:55 AM »
Just a quick note to let you guys know I'll be away for a few days on a trip and will be back on April 1st. I will have limited internet access so I doubt I'll be able to provide support during that period.

See you in a few days!

General Discussions / Re: Center on zoom
« on: 26 March, 2014, 11:43:33 AM »
Hi Hexaust,

Yeah you also need to rotate the camera toward the pinch center while the pinch is happening. One way to do this is to project the gesture.Position to world space, at a far enough distance, and then have the camera LookAt() this point. You should use Camera.ScreenPointToRay() method to get a world-space ray from the gesture's screen space position, and from there you can get your project point like so (pseudo code, haven't tested):

Code: [Select]
Ray ray = Camera.main.ScreenPointToRay( gesture.Position );
Vector3 p = ray.origin + ray.direction * 1000.0f;
Camera.main.transform.LookAt( p );

Note: 1000.0f is an arbitrary distance.

Hi Alex,
Sorry for the super slow reply here.

There's no support for forcing a gesture to end at the moment, but you should be able to replicate the behavior you're after by using custom logic. For instance, you could set a "dragging" boolean flag in OnDrag.Begin and then only react to the Update/End phase events if the dragging flag is still set. Would that work for you?

Support / Re: FG31 dot net events how to
« on: 15 March, 2014, 08:38:11 PM »
Hi Dan,
In the docs, there's an example on how to detect tap gesture using the .net events.

For a double tap, it would be exactly the same steps but you'd just configure your TapRecognizer to trigger on two consecutive taps instead of one (set RequiredTaps = 2). To setup the .net event handler, you'd get a reference to that TapRecognizer and subscribe to its OnGesture event.

Here's a quick code-driven sample to show you quickly how it's done with other gesture recognizers or finger detectors:

Code: [Select]
void Awake()
    TapRecognizer doubleTap = gameObject.AddComponent<TapRecognizer>();
    doubleTap.RequiredTaps = 2;
    doubleTap.UseSendMessage = false;   // optional - disables SendMessage() to self & selection
    doubleTap.OnGesture += doubleTap_OnGesture;

    FingerHoverDetector hoverDetector = gameObject.AddComponent<FingerHoverDetector>();
    hoverDetector.OnFingerHover += hoverDetector_OnFingerHover;

    PinchRecognizer pinch = gameObject.AddComponent<PinchRecognizer>();
    pinch.OnGesture += pinch_OnGesture;

void doubleTap_OnGesture( TapGesture gesture )
    //TODO: add code to handle the double tap event here

void hoverDetector_OnFingerHover( FingerHoverEvent eventData )
    //TODO: add code to handle the hover event here

void pinch_OnGesture( PinchGesture gesture )
    //TODO: add code to handle the pinch gesture event here

Does this help, or would you like more details?

Pages: [1] 2 3 ... 44