hongguang.li Posted March 16 Share Posted March 16 The camera follows the object. When the object moves, the object in the window shakes。 How can a camera follow a flying object, such as an airplane? For example, create multiple Windows that show how the plane is flying from all angles. I use the camera as a child node of the plane,The following code: public override bool Update() { foreach (var item in DataCenter.viewport_all) { item.newviewport.SetCamera(item.mPlayer.Camera); } } A flicker appears in the window. Thanks! Link to comment
cash-metall Posted March 17 Share Posted March 17 Hello! please describe in more details what type of item.newviewport? it is WidgetViewport ? Сan you make a short video to understand the kind of shaking? Link to comment
hongguang.li Posted March 19 Author Share Posted March 19 On 3/17/2023 at 4:53 PM, cash-metall said: Hello! please describe in more details what type of item.newviewport? it is WidgetViewport ? Сan you make a short video to understand the kind of shaking? like this ccc6e0ff1b20a07385dd68d5a34f52de.mp4 e6614f82105982f8ce0bd2f88165946b.mp4 Link to comment
cash-metall Posted March 20 Share Posted March 20 Thank you for the video! Now it is clear what kind of shaking we are talking about. This type of shaking can occur due to an incorrect update order: 1. The camera position is set before all objects have updated their positions. Try to move update camera position to post update (or later in update) 2. If that doesn't help, it might be a WidgetSpriteViewport issue - it calls render in update. to avoid this problem - you need to use Viewport + WidgetSprite instead of WidgetSpriteViewport. This will give you more control over the render and call order. (see attach file) also you can find more examples with custom viewports in cpp_samples -> multi_view_split UPD: I just noticed that this is a thread about C#API. the api is actually very similar. write if you have any difficulties, we will help you fix the snippet in c#. WidgetSprite + Viewport.txt Link to comment
Recommended Posts