Jump to content

The camera follows the object. When the object moves, the object in the window shakes。


photo

Recommended Posts

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

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

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
×
×
  • Create New...