This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:tutorials:viewport:viewport [2020/08/21 06:05 (5 years ago)] – ↷ Links adapted because of a move operation sausage | en:tutorials:viewport:viewport [2021/02/11 21:29 (4 years ago)] (current) – Updated for recent config changes sausage | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Summary ===== | ===== Summary ===== | ||
- | See previous basic tutorials for more info about [[..: | + | See previous basic tutorials for more info about [[..: |
This tutorial shows how to use multiple viewports with multiple cameras.\\ | This tutorial shows how to use multiple viewports with multiple cameras.\\ | ||
Line 30: | Line 30: | ||
//NB: Cameras store their position/ | //NB: Cameras store their position/ | ||
- | as seen in the [[..: | + | as seen in the [[..:objects: |
As a result, object auto-following can be achieved by setting the object as the camera' | As a result, object auto-following can be achieved by setting the object as the camera' | ||
On the other hand, having a camera as parent of an object will insure that the object will always be displayed at the same place in the corresponding viewport ((very useful for making HUD & UI, for example)).// | On the other hand, having a camera as parent of an object will insure that the object will always be displayed at the same place in the corresponding viewport ((very useful for making HUD & UI, for example)).// | ||
Line 49: | Line 49: | ||
Let's jump directly to our '' | Let's jump directly to our '' | ||
- | First we snap our soldier guy under the mouse position. We've already seen such a thing in the [[..: | + | First we snap our soldier guy under the mouse position. We've already seen such a thing in the [[..:objects: |
Here we do the exact same thing and we see that it works perfectly with multiple viewports.\\ | Here we do the exact same thing and we see that it works perfectly with multiple viewports.\\ | ||
When the mouse is not over a viewport, '' | When the mouse is not over a viewport, '' | ||
Line 135: | Line 135: | ||
<code ini> | <code ini> | ||
- | Camera | + | Camera |
- | RelativeSize | + | Size |
- | RelativePosition | + | UseRelativeSize = true |
- | BackgroundColor | + | Position |
+ | BackgroundColor = (0, 100, 0) ~ (0, 255, 0) | ||
[Viewport2] | [Viewport2] | ||
- | Camera | + | Camera |
- | RelativeSize | + | Size |
- | RelativePosition | + | UseRelativeSize = true |
- | BackgroundColor | + | Position |
+ | BackgroundColor = (100, 0, 0) ~ (255, 0, 0) | ||
[Viewport3] | [Viewport3] | ||
Camera | Camera | ||
- | RelativeSize | + | Size |
- | RelativePosition | + | UseRelativeSize |
+ | Position | ||
BackgroundColor | BackgroundColor | ||
[Viewport4] | [Viewport4] | ||
Camera | Camera | ||
- | RelativeSize | + | Size |
- | RelativePosition | + | UseRelativeSize |
+ | Position | ||
BackgroundColor | BackgroundColor | ||
Line 164: | Line 168: | ||
In other words, each viewport covers exactly a quart of our display, whichever sizes we have chosen for it, fullscreen or not.\\ | In other words, each viewport covers exactly a quart of our display, whichever sizes we have chosen for it, fullscreen or not.\\ | ||
- | As you may have noticed, we only gave an explicit value for the '' | + | As you may have noticed, we only gave an explicit value for the '' |
- | All the other viewports inherits from the '' | + | All the other viewports inherits from the '' |
- | That means that this value will be the same than the one from '' | + | That means that this value will be the same than the one from '' |
We did it exactly the same way for '' | We did it exactly the same way for '' | ||
We then need to place them on screen to prevent them to be all displayed on top of each other.\\ | We then need to place them on screen to prevent them to be all displayed on top of each other.\\ | ||
- | To do so, we use the property '' | + | To do so, we use the property '' |
Lastly, the first three viewports use different shades for their '' | Lastly, the first three viewports use different shades for their '' |