Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Tue Mar 19, 2024 8:29 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Jun 06, 2007 6:33 pm 
Offline

Joined: Wed Jun 06, 2007 2:12 am
Posts: 2
I messed around in the source and added a new camera mode that, in my opinion, is much better than the current one.

Rather than trying to stare at the back bumper of the car, it simply tries to follow the car. This means that when the car spins out of control, the camera doesn't. Also, when driving backwards, you can see where you're going.

I added it as a checkbox in the options screen.

Is there any way I could get this included in the official code? I'm really new to Raydium and I don't know how things work around here. Sorry if this is an ignorant question.

Here's my modified mania_drive.c.
Here's the diff file for the changes I made. (I used the mania_drive.c from the ManiaDrive 1.2 source download)
Code:
46a47,49
> dReal cam_pos[3]={0,0,0};
>
> signed char camera_alternate;
689a693
> camera_alternate=raydium_gui_read_name("menu","chkCameraAlternate",str);
698a703,706
> str[0]=(camera_alternate?'y':'n');
> raydium_parser_db_set("ManiaDrive-CameraAlternateActive",str);
>
> str[1]=0;
1074a1083,1085
> raydium_gui_check_create("chkCameraAlternate",handle,10,77," Alternate camera behavior",camera_alternate);
>
> raydium_gui_widget_sizes(4,4,18);
2360a2372,2373
>    dReal dist_vector[3];
>    dReal car_to_cam_distance;
2374a2388,2405
>    // calculate the alternate camera position
>    dist_vector[0] = cam_pos[0]-pos[0];
>    dist_vector[1] = cam_pos[1]-pos[1];
>    dist_vector[2] = cam_pos[2]-pos[2];
>    // find the distance from car to camera
>    car_to_cam_distance = sqrt(dist_vector[0]*dist_vector[0] + dist_vector[1]*dist_vector[1] + dist_vector[2]*dist_vector[2]);
>    // determine new camera position by scaling down the distance vector to be exactly 1 unit long,
>    // and then using that vector as an offset from the car's position
>    cam_pos[0] = pos[0] + (dist_vector[0]/car_to_cam_distance);
>    cam_pos[1] = pos[1] + (dist_vector[1]/car_to_cam_distance);
>    cam_pos[2] = pos[2] + (dist_vector[2]/car_to_cam_distance);
>    
>    if(camera_alternate) {
>       cam[0] = cam_pos[0];
>       cam[1] = cam_pos[1];
>       cam[2] = cam_pos[2] + 0.4;
>    }
>
2490a2522
> char altCamActive[RAYDIUM_MAX_NAME_LEN];
2556a2589,2591
> raydium_parser_db_get("ManiaDrive-CameraAlternateActive",altCamActive,"y");
> camera_alternate=(altCamActive[0]=='y'?1:0);
>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 10:20 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
great, i like it !
And this is the first time i have seen the face of the driver ;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 3:15 pm 
Offline

Joined: Wed Jun 06, 2007 2:12 am
Posts: 2
Thanks, I'm glad to hear that.

Is there any way I can get this into the official source? Should I PM Xfennec?

EDIT: Nevermind, I read about SVN in the wiki and I'll requested an SVN login in the devel forum.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 09, 2007 10:22 am 
Offline

Joined: Thu May 25, 2006 8:26 pm
Posts: 47
Great view!

:wink:


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 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