MrHayato
Topic Author
Posts: 36
Joined: 19 Sep 2014, 21:29

[Unity] Update loop or render event

20 Jan 2015, 23:52

Hi,

I was wondering of Noesis (for Unity) exposes any sort of render event or update loop so that I can run some physics calculations for Noesis FrameworkElements?

Thanks

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 1680
Joined: 22 Dec 2011, 19:20

Re: [Unity] Update loop or render event

21 Jan 2015, 11:29

Sorry, but there is no such event in NoesisGUI. Anyway, I think it would be enough to write your code in any MonoBehavior Update/FixedUpdate event. Is there any reason why you can't use these events?
 
MrHayato
Topic Author
Posts: 36
Joined: 19 Sep 2014, 21:29

Re: [Unity] Update loop or render event

21 Jan 2015, 19:36

We need to be able to run physics simulations on the ScrollViewer depending on what the input is. For example, swiping your mouse up and down on the scroll viewer will scroll up and down, but instead of actually scrolling it, we want to add friction to the scrolling, so we need to apply velocity over time, which is why we need an update loop. Making a MonoBehaviour would be a nightmare to coordinate with code behind.

WPF has CompositionTarget.Rendering event which can be used, something similar for noesis would be very useful.
 
User avatar
jsantos
Site Admin
Posts: 2603
Joined: 20 Jan 2012, 17:18
Contact:

Re: [Unity] Update loop or render event

22 Jan 2015, 11:58

Yes, we could add the event CompositionTarget.Rendering, although I wonder if there is a better solution for this. For doing something very similar (accelerations and decelerations) we use Manipulation Events, in fact, the event ManipulationDelta is called per frame for that purpose.

Our Scrollviewer is enabling those events by setting IsManipulationEnabled to true. Right now, this only works for Touch events. If they worked also for mouse events will it be a valid solution for you?
 
MrHayato
Topic Author
Posts: 36
Joined: 19 Sep 2014, 21:29

Re: [Unity] Update loop or render event

28 Jan 2015, 20:33

We were initially going to use manipulation events, but we also want to be able to control the physics ourselves so that's why we're implementing it ourself. Specifically adding things like drag so the view kind of lags behind the mouse when we scroll. CompositionTarget.Rendering would be best as we can also adapt this to other controls in the future (including custom controls).
 
User avatar
jsantos
Site Admin
Posts: 2603
Joined: 20 Jan 2012, 17:18
Contact:

Re: [Unity] Update loop or render event

29 Jan 2015, 17:43

Understood, please file a bug about this. Thanks!
 
lanihou
Posts: 7
Joined: 10 Feb 2018, 20:08

Re: [Unity] Update loop or render event

10 Apr 2019, 06:01

Hi , is there any update on the subject?
seems like there is no CompositionTarget.Rendering in noesis.
I want to do a time based movement of an image inside a canvas.
I need
- a way to get the elapsed time between frame ( the noesis way )
- an update loop (or rendering event ) where i can calculate new position based on speed an time. ( the noesis way )

I know i can collect info in monobehaviour update method an pass it to noesis canvas
but i wanted to be sure there is not a better way (integrated in noesis) to achieve this
thank
 
User avatar
sfernandez
Site Admin
Posts: 1680
Joined: 22 Dec 2011, 19:20

Re: [Unity] Update loop or render event

10 Apr 2019, 12:56

The View exposes a Rendering event that is called on each view update, and changes made to the UI tree in that event handler will be processed in that same frame.

That event doesn't expose the elapsed time as it receives an EventArgs instance, although investigating this now I just discovered that WPF is in fact passing there an instance of a RenderingEventArgs which provides the RenderingTime (not the elapsed, but the actual update time). Could you please create a ticket in our bugtracker referencing this so we can implement it correctly?

In the meantime, to get the time in Unity you can use Time.time, as that is the time we are using to update the View and it'll be the same you would receive from the Rendering event.

Who is online

Users browsing this forum: No registered users and 5 guests