Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Mar 28, 2024 2:21 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Add a mirror camera
PostPosted: Thu Aug 19, 2010 12:44 am 
Offline

Joined: Thu Aug 19, 2010 12:32 am
Posts: 2
Hello. This is Eduardo from Brazil.

I'm working on a experiment to evaluate the driver behavior when he is about to crash laterally with another car. For that, ManiaDrive is being used.

It came up the need to have lateral rear mirrors for the driver to identify the other car, in a crash path.

The only way I found to have the rear mirrors is to place a viewport camera in each side of the car, using the following line codes (example for right side mirror):

raydium_viewport_enable("camera2");
raydium_window_view_perspective(50,0.02,100);
raydium_ode_element_camera_inboard_name("corps",0.25,0.40,0,-0.5,0.75,0.2);
raydium_sky_box_render(raydium_camera_x,raydium_camera_y,raydium_camera_z);

raydium_camera_replace();
raydium_ode_draw_all(RAYDIUM_ODE_DRAW_NORMAL);
raydium_viewport_save();
raydium_clear_frame();

But by doing that, the image appears wrongly mirroed (when the other car moves to the right on my back, the mirror shows it going to the left). Of course that is because it is the point of view of the camera.

Do you know how to produce a correct mirror effect?


Top
 Profile  
 
 Post subject: Re: Add a mirror camera
PostPosted: Thu Aug 19, 2010 11:41 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Interesting question !
The solution is to change the way you're rendering the viewport:
Code:
// this is the mirror:
raydium_viewport_draw("camera2",80,70,-60,30);

// ... of this:
raydium_viewport_draw("camera2",20,70,60,30);


I've updated the documentation accordingly, thanks for this question :)


Top
 Profile  
 
 Post subject: Re: Add a mirror camera
PostPosted: Wed Oct 06, 2010 12:19 am 
Offline

Joined: Thu Aug 19, 2010 12:32 am
Posts: 2
Great! It works, thanks a lot!

The experiments were carried out.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group