Outerra forum

Outerra Engine => Ideas & Suggestions & Questions => Topic started by: fly77 on September 20, 2018, 06:07:19 am

Title: more viewpoint options
Post by: fly77 on September 20, 2018, 06:07:19 am
As a flightsimmer I'd like to see some more viewpoint options in outerra, such as flyby view mode and ability to move inside planes,vehicles, cockpit while airplane/vehicles are in motion.
Title: Re: more viewpoint options
Post by: 2eyed on September 20, 2018, 09:55:43 am
If you use a VR hmd, you can literally physically move inside the cockpit.
Title: Re: more viewpoint options
Post by: fly77 on September 20, 2018, 11:45:09 am
Interesting. Unfortunately I don't own any VR headset. Would be interesting though, making these capabilities accessible also via the keyboard/mouse or joystick.
Title: Re: more viewpoint options
Post by: josem75 on September 20, 2018, 03:01:25 pm
FlyBy would be nice in Outerra.  I have some Topic time ago where i put suggestions and some kind of flyby was one.
Title: Re: more viewpoint options
Post by: fly77 on September 20, 2018, 03:16:42 pm
I actually just now discovered with great pleasure that when in an airplane (Cessna) by pressing CTRL+V you can switch between different viewpoints inside and outside the plane. Very nice ! Seems to work also on some vehicles (tatra truck) allthough with much fewer viewpoint choices. Would be nice to know if different viewpoints can be set in the javascript file of planes and vehicles.
Title: Re: more viewpoint options
Post by: KW71 on September 20, 2018, 05:38:59 pm
I actually just now discovered with great pleasure that when in an airplane (Cessna) by pressing CTRL+V you can switch between different viewpoints inside and outside the plane. Very nice ! Seems to work also on some vehicles (tatra truck) allthough with much fewer viewpoint choices. Would be nice to know if different viewpoints can be set in the javascript file of planes and vehicles.

Perhaps you already aware, but pressing "c" lets you move the camera around, changing the distance with the scroll wheel... And yes, you can add more cameras in the script.
Title: Re: more viewpoint options
Post by: fly77 on September 20, 2018, 06:54:24 pm
Thanks. Would it be possible to create also a fly-by or drive-by  camera mode from within the javascript ? Is it possible to access the world coordinates of the vehicle/plane from within the javascript ? and then maybe use these to place a "temporary" fixed camera ?
Title: Re: more viewpoint options
Post by: KW71 on September 20, 2018, 07:41:21 pm
I don't know much about scripting (I should say "almost noghint"). But if what you want is to see your plane flying from outside, why not just press "c" and move the camera around?
Title: Re: more viewpoint options
Post by: fly77 on September 20, 2018, 08:57:17 pm
"fly-by" is when an observer sees the plane passing near him...such ad this https://youtu.be/eL0_A2g8TKM (https://youtu.be/eL0_A2g8TKM).
I will try if i can move the camera in time from within the script trying to move her by the plane.
Title: Re: more viewpoint options
Post by: patmarrnc on September 21, 2018, 08:59:39 am
is it not already possible in the 2nd camera position (press C twice) to zoom out for the purpose of watching a vehicle drive or fly by? I rarely fly the aircraft, but this works with cars and watercraft.
Title: Re: more viewpoint options
Post by: fly77 on September 21, 2018, 09:44:46 am
Which vehicle/plane you are using: For me double pressing C does nothing. It remain sthe same camera and that camera for me at least is outside but stationary with respect to the plane/vehicle. Not a fly-by/drive by.
Title: Re: more viewpoint options
Post by: patmarrnc on September 21, 2018, 12:44:51 pm
I think the reason why nothing happens when you press the C key is because you haven't changed your orientation yet for that camera view.

Camera view #1: first person driver's view, which is defined in the script

Camera view #2: Camera assumes whatever position you give it in absolute coordinates. I think this is what you want.  After spawning your vehicle, press C once, then scroll away with the mouse and scroll wheel.  Whatever view you create is the new #2 camera position.  In this view the world keeps its position, and the vehicle moves around in a stable world. So Camera 2 could be located wherever you want it as a plane flies past.

Camera view #3: This is like camera view #2, except instead of the camera maintaining an absolute origin in the world, the camera follows the vehicle.  In other words, the vehicle stays oriented the same way, and the world revolves around it (like the car avatar on a GPS screen).  Positioning camera #3 behind and above a vehicle is a good way to steer effectively.

Once you have established each of the 3 camera views, you can toggle between them by pressing C

You can also change the camera view with the scroll wheel and mouse in Camera view 2 or 3. In order to change camera view #1 you have to edit the script.

Title: Re: more viewpoint options
Post by: fly77 on September 21, 2018, 01:28:45 pm
OK I understand what you mean  by clicking C repeatedly on the screen appear
1) first person
2) third person
3) third person follow
I can change the viewing distance and orientation for views 2) and 3) with the mouse+mousewheel.
I used this of course. But In any case for both views 2) and 3) the camera follows the vehicle...
what I'd like is to have a camera fixed to the ground and see the vehicle move by. That's not possibly with these 3 views.

I found a way achieve a drive-by camera by creating a "dynamic" first persion view camera in the vehicle reference system by the following code additions to the vehicle javascript file.


Code: [Select]
.....
var seat_cam = 0;
function switch_seat(cam)
{
if(cam===0)   seat_cam=0;   // driver seat
else if(cam===1)seat_cam=1;  // front wheel
else if(cam===2)seat_cam=2;  // rear wheel
      else if(cam===3)seat_cam=3;  // drive-by camera
      else return false;
return true;
}

var distance=0;
var flag=0;

....

function init_chassis()
{
...
}

...

function init_vehicle(){
.....
}

function update_frame(dt, engine, brake, steering)
{
....
if(seat_cam===0){
    flag=0;
    this.set_fps_camera_pos({x:-0.1,y:-0.90,z:1.50});
    }
  else if(seat_cam===1){
    flag=0;
    this.set_fps_camera_pos({x: -0.95, y:0.2, z:0.5});
    }
  else if(seat_cam===2){
    flag=0;
    this.set_fps_camera_pos({x:-0.45, y:-1, z:0.5});
    }
  else if(seat_cam===3){
    if (flag==0){
     
      distance=0;
      flag=1;
    }
    else{
      distance=distance+this.speed()*dt;
      this.set_fps_camera_pos({x:2, y:30-distance, z:0.8});
      if (distance>2*30){
        distance=0;
      }
    }
  }
...
}



Here is a very crappy video https://www.dropbox.com/s/pmvaolwe56uzd4d/bike-ride-by.mp4?dl=0 (https://www.dropbox.com/s/pmvaolwe56uzd4d/bike-ride-by.mp4?dl=0) recorded with my smartphone as the inbuild video recording of outerra for the moment gives me problems.
You can see the desired drive-by effect and also the problems my solution has. At the end of the vedio as the bike drives towards sloped terrain the camera view woobles and goes below ground. This is because the z coordinate of the camera is defined relative to the vehicle reference system which wobbles and reproduces terrain slopes. Ideally the camera should be set fixed in absolute world coordinates at a fixed point but I don't know how to get the world coordinates of the vehicle and how to set a camera fixed in space at these coordinates - all in the javascript.
Title: Re: more viewpoint options
Post by: patmarrnc on September 21, 2018, 02:26:07 pm
you can also change the camera's orientation in real time, facing right when the vehicle is to the right, then turning to face the vahiclas as it passes to your left.  It isn't the same as a fixed camera, but depending on your needs it might provide usable video footage.

Bu yeah, now that I see what you mean, I'd also like to see a 4th camera position that is fixed wherever we place it. The ability to capture any kind of motion as it passes by would be useful to me as an animator.  Good idea! 
Title: Re: more viewpoint options
Post by: fly77 on September 21, 2018, 02:40:10 pm
I have added in the above note a video and a script that gives a drive-by camera that works, but only on reasonably flat (not too rough and not too sloped) ground. Sorry for the crappy video above. Here is a slightly better one that shows better the good things and the bad ones of my "workaround" solution.https://www.dropbox.com/s/e9lkvsg5r3rjp6r/bike-ride-by2.mp4?dl=0 (https://www.dropbox.com/s/e9lkvsg5r3rjp6r/bike-ride-by2.mp4?dl=0).
Title: Re: more viewpoint options
Post by: Bob425 on September 21, 2018, 04:13:41 pm
That video is very impressive. almost as impressive as a riderless bike!
Title: Re: more viewpoint options
Post by: fly77 on September 21, 2018, 04:29:56 pm
Thanks. Unfortunatey the "drive-by" camera mode creates a camera that is not really fixed with respect to ground. It is so only if the vehicle doesn't steer. Steering moves the camera "sideways" by a distance =  (steering angle*distance of camera from bike) due to a "lever effect". Therefore it is quite hard to drive curves in "drive-by camera mode" and the view is jumping around a little bit too much when steering. At least when using the keyboard to steer. Maybe I'd better try with my steering wheel. In any case this is only a "workaround" which is not perfect at all. The camera should be placed using World coordinates not by using offsets in the vehicle coordinate system as then steering rotates the latter reference system and so moves the camera with respect to the world.  Unfortunately I don't know how to achieve this.
Title: Re: more viewpoint options
Post by: fly77 on September 21, 2018, 04:56:23 pm
I tried to slighty optimize the position of the camera (a little higher (z) to avoid going below ground and to have a better anticipation of coming curves, and a little more sideways (x) from the bike. Keeping the map (M) open at max zoom also helps to anticipate coming curves so that I can slow down in time. Moreover assigning "Toggle seat" in the outerr menu /controls /advanced seetings /ot  instead of "V" key (I used CTRL+V but V alone works the same) a "middle mousebutton press" switching back and forth between cameras can be made on the fly as the hand needs to stay on the mouse anyway. So when "unknow" is ahead press the middle mouse button to switch to more useful steering camera views.

Code: [Select]
...
 this.set_fps_camera_pos({x:3, y:30-distance, z:1.8});
      if (distance>2*30){
..

When used with my drivingwheel camera movement and bike steering are much more smooth now and it seems to me that it becomes quite practible even to drive around constantly using the "drive-by" camera mode...of course its use for driving is not ideal but for cinema scenic effect its quite spectacular indeed. Just one thing: I noticed on the map actually the arrow reports the position of the camera not of the bike and as the two in this case do not coincide this is somewhat confusing.

Here you can download the updated version of bike1.       https://www.dropbox.com/s/zfhv8kd031fpeah/bike1.otx?dl=0 (https://www.dropbox.com/s/zfhv8kd031fpeah/bike1.otx?dl=0)


Before installing please backup the previous version you may eventually have installed allready.
Title: Re: more viewpoint options
Post by: patmarrnc on September 21, 2018, 06:20:26 pm
another workaround to try:
I've noticed that when I accidentally hit ENTER while driving, it releases the vehicle from my control, and it continues on its own, while I am free to navigate elsewhere.

You could get your bike moving in a straight line, position your camera off to the side for a drive by shot, then press ENTER so the vehicles movement no longer affects the camera. That way you can have full control of your camera (but no control over the bike). For a short scene in a video, it could yield a usable snippet. Or not.
Title: Re: more viewpoint options
Post by: fly77 on September 21, 2018, 06:26:33 pm
certainly one can try but its probably a matter of luck to get everything set up right. I have uploaded the new version of bike1 (backup the older version) above , you can try if its useful to get video snippets. As you never abandon the bike "on its own" you can retry easily many times (just as you driving a real bike and having a cameraman filming you driving by). Have fun.