|
Post by F1Andre on Mar 10, 2015 4:58:05 GMT
Hi, I have been struggeling on this for hours now where it only should've taken about 20 minutes. I made a camera change scrip but i can't get the cameras to change view.
Here's my code and the project below. Thank you for the help.
int camera1 = OBJ_0; int camera2 = OBJ_22; int camera3 = OBJ_44; int camera4 = OBJ_66; int camera5 = OBJ_88; int camCount = 1; //************The following shows and hides the cameras to view different view***********// void showHideCam1() { iObjectHide(camera2); iObjectHide(camera3); iObjectHide(camera4); iObjectHide(camera5); iObjectShow(camera1); iObjectStop(camera2); iObjectStop(camera3); iObjectStop(camera4); iObjectStop(camera5); iObjectStart(camera1); }
void showHideCam2() { iObjectHide(camera1); iObjectHide(camera3); iObjectHide(camera4); iObjectHide(camera5); iObjectShow(camera2); iObjectStop(camera1); iObjectStop(camera3); iObjectStop(camera4); iObjectStop(camera5); iObjectStart(camera2); }
void showHideCam3() { iObjectHide(camera1); iObjectHide(camera2); iObjectHide(camera4); iObjectHide(camera5); iObjectShow(camera3); iObjectStop(camera1); iObjectStop(camera2); iObjectStop(camera4); iObjectStop(camera5); iObjectStart(camera3); }
void showHideCam4() { iObjectHide(camera1); iObjectHide(camera2); iObjectHide(camera3); iObjectHide(camera5); iObjectShow(camera4); iObjectStop(camera1); iObjectStop(camera2); iObjectStop(camera3); iObjectStop(camera5); iObjectStart(camera4); }
void showHideCam5() { iObjectHide(camera1); iObjectHide(camera2); iObjectHide(camera3); iObjectHide(camera4); iObjectShow(camera5); iObjectStop(camera1); iObjectStop(camera2); iObjectStop(camera3); iObjectStop(camera4); iObjectStart(camera5); }
void minMaxCamCount() { if(camCount < 1) camCount = 1; if(camCount > 6) // There are only cams but setting this value higher allows us to make the camCount go back to 1 if the player cycles thru the cam views camCount = 6; if(camCount == 6) camCount = 1; // If the value is 6 the camCount go's back to 1 so that the player can cycle thru all the views and still allow him to return to cam 1 after he has viewed cam 5 }
void Main() { if(iKeyDown(iKeyCode("DIK_C"))) { camCount += 1; minMaxCamCount(); } if(camCount == 1) { showHideCam1(); } if(camCount == 2) { showHideCam2(); } if(camCount == 3) { showHideCam3(); } if(camCount == 4) { showHideCam4(); } if(camCount == 5) { showHideCam5(); } }
Attachments:Cam Change.3dr (247.53 KB)
|
|
|
Post by F1Andre on Mar 10, 2015 5:49:20 GMT
Note, that when I remove the iobject start and stop, the script works. But since my game will take alot of processing power I would like to disable the camera to allow me to use that extra bit of processing power somewhere else.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 10:22:39 GMT
like this you can set a default camera, because when i played the project it starts from the cam chase i have selected, and if the code is too complex keep it simple and stupid use the inbuilt 3d rad functions you just need four event on inputs, i will upload a 3dr file to show that..
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 10:45:54 GMT
HERE IS THE FILE link- www.dropbox.com/s/hlupymbvittdael/camera%20views.3dr?dl=0-for changing camera angles which hides the other 2 when you press the camera button and if you press another button it hides the other ones and shows the view you selected, i tried to start and stop camera but it don't works as there is no "working at start" option in the camera so you can't start or stop it to save a bit, but logically if you start and stop and then start another cameras i think that will take more time because the hide option only hides it from view it does not restarts and restarts should take more time than just showing or hiding.
|
|
|
Post by F1Andre on Mar 10, 2015 12:22:15 GMT
Thanks, so I don't really need to stop the object(wich apperantly can't be done) I just have do disable rendering wich can be done by I object hid or show
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 12:29:37 GMT
correct! it will also save the processing power by not rendering 3 cams but 1 at a time..
|
|
|
Post by F1Andre on Mar 10, 2015 12:42:56 GMT
Okay I have updated the script and will post within the next half our. I have also inserted a part that will cahnge the cameras more smoothly so that the cameras don't constantly change when you hold C to change view.
|
|
|
Post by F1Andre on Mar 10, 2015 12:48:37 GMT
Okay here's the updated script, use the previous .3dr project and just change the script.
<font size="2">int camera1 = OBJ_0; int camera2 = OBJ_22; int camera3 = OBJ_44; int camera4 = OBJ_66; int camera5 = OBJ_88; int camCount = 1; int camCountR = 0;
//************The following shows and hides the cameras to view different view***********// void showHideCam1() { iObjectShow(camera1); iObjectHide(camera2); iObjectHide(camera3); iObjectHide(camera4); iObjectHide(camera5); }
void showHideCam2() { iObjectHide(camera1); iObjectHide(camera3); iObjectHide(camera4); iObjectHide(camera5); iObjectShow(camera2); }
void showHideCam3() { iObjectHide(camera1); iObjectHide(camera2); iObjectHide(camera4); iObjectHide(camera5); iObjectShow(camera3); }
void showHideCam4() { iObjectHide(camera1); iObjectHide(camera2); iObjectHide(camera3); iObjectHide(camera5); iObjectShow(camera4); }
void showHideCam5() { iObjectHide(camera1); iObjectHide(camera2); iObjectHide(camera3); iObjectHide(camera4); iObjectShow(camera5); }
void minMaxCamCount() { if(camCount < 1) camCount = 1; if(camCount > 6) // There are only cams but setting this value higher allows us to make the camCount go back to 1 if the player cycles thru the cam views camCount = 6; if(camCount == 6) camCount = 1; // If the value is 6 the camCount go's back to 1 so that the player can cycle thru all the views and still allow him to return to cam 1 after he has viewed cam 5 } void Main() {
// Helps keep a steady flow for when changing gear, without this gears will increment by more than one if( !iKeyDown(iKeyCode("DIK_C")) ) { camCountR = 0; } if(iKeyDown(iKeyCode("DIK_C")) && camCountR == 0) { camCount += 1; minMaxCamCount(); camCountR = 1; } if(camCount == 1) { showHideCam1(); } if(camCount == 2) { showHideCam2(); } if(camCount == 3) { showHideCam3(); } if(camCount == 4) { showHideCam4(); } if(camCount == 5) { showHideCam5(); } } </font>
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 13:02:10 GMT
lets try this
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 13:05:37 GMT
i tried it but the cameras are not chasing the car, so how will you implement it in a game and the cam you select in the editor starts only, there are no editors in the compiled version...
|
|
|
Post by F1Andre on Mar 10, 2015 13:08:07 GMT
Remember reactivate the cam object. Top right hand side when you open camera
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 13:22:13 GMT
do you mean "turn on the rendering at start option"?
|
|
|
Post by F1Andre on Mar 10, 2015 13:28:26 GMT
Not that, it is the little check box at the most top tight hand side that says "active" just check that box
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 13:34:45 GMT
Kkkk I un
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 13:35:54 GMT
Kkkk I understand that, I will try it in 10 mins
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 13:44:41 GMT
I HAVE TO TICK THE ACTIVE AS WELL AS THE RENDERING AT START TO MAKE IT WORK BUT IT STILL DOESN'T CHANGES CAMERA ANGLES.
|
|
|
Post by F1Andre on Mar 10, 2015 14:03:07 GMT
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 14:21:27 GMT
cool it works now, did you changed anything?
|
|
|
Post by F1Andre on Mar 10, 2015 14:30:22 GMT
I removed the iObject start and stop from the functions and added a small piece of code that will regulate the flow so that the camera doesn't change like 5 times when the key key was only pressed once. here is that extra piece of code.
if( !iKeyDown(iKeyCode("DIK_C")) ) { camCountR = 0; } if(iKeyDown(iKeyCode("DIK_C")) && camCountR == 0) { camCount += 1; minMaxCamCount(); camCountR = 1;
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 10, 2015 14:34:16 GMT
cool i think this will work more effectively than the event on input
|
|