Outerra Engine > Ideas & Suggestions & Questions

more viewpoint options

<< < (3/4) > >>

fly77:
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.

patmarrnc:
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.

fly77:
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: ---.....
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;
      }
    }
  }
...
}



--- End code ---

Here is a very crappy video 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.

patmarrnc:
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! 

fly77:
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.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version