3D Rad - Free 3D game maker - Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Coming soon: software updates

Pages: [1] 2

Author Topic: Enter and Exit Vehicle v2.0  (Read 813 times)

electron_theory

  • 3D Rad Guru
  • *****
  • Posts: 771
    • WWW
Enter and Exit Vehicle v2.0
« on: May 20, 2010, 04:41:01 PM »
Code: [Select]
/Script for Entering and Exiting Vehicle
//To use this script, The working at start button should be unchecked
//This script should be started by an EventOnLocation Object that is
//parented by the Vehicle Object that is being entered.  This script
//will place the character in the center of the EventOnLocation object
//upon exit, so make sure that the EOL area is accessible

int InVehicle = 0;
Vector3 VehicleLocation;
float timer;


void Main()
{
if(iInitializing()){timer = 0;}

iObjectLocation(OBJ_0,VehicleLocation);//This is the location of the EOL object

   if(iKeyDown(iKeyCode("DIK_T")) &&timer < 0.016667){
      iObjectStop(OBJ_88); //Stop Character Object
      iObjectHide(OBJ_66); //Stop Character Camera
      iObjectStop(OBJ_44);   //Character RigidBody
      iObjectHide(OBJ_110); //Hide Character Mesh
      iObjectStart(OBJ_22);//Start Vehicle
      iObjectShow(OBJ_132);//Start Vehicle Camera
      InVehicle= 1 ;
      }
   if (InVehicle ==1) timer+= 0.016667;
   
   if (iKeyDown(iKeyCode("DIK_T")) && timer > 3){
      iObjectStart(OBJ_88);
      iObjectShow(OBJ_66);
      iObjectStart(OBJ_44);
      iObjectLocationSet(OBJ_44,VehicleLocation); //Relocate the Character Rigidbody to the EOL
      iObjectShow(OBJ_110);
      iObjectStop(OBJ_22);
      iObjectHide(OBJ_132);
      InVehicle = 0;
     
}
//VAL_1=timer;
}
« Last Edit: May 23, 2010, 04:58:33 PM by archangel »
Logged

electron_theory

  • 3D Rad Guru
  • *****
  • Posts: 771
    • WWW
Re: Enter and Exit Vehicle
« Reply #1 on: May 20, 2010, 10:40:22 PM »
And a quick .3dr that I whipped up...

Enter the vehicle by walking to the driver's door and hitting "T"...

Escape the vehicle by hitting "T".
« Last Edit: May 22, 2010, 10:15:56 AM by archangel »
Logged

electron_theory

  • 3D Rad Guru
  • *****
  • Posts: 771
    • WWW
Re: Enter and Exit Vehicle
« Reply #2 on: May 21, 2010, 11:47:37 AM »
Send some feedback my way, so I know what I can Improve upon

psikoT

  • 3D Rad Guru
  • *****
  • Posts: 1118
  • I love this shit!
Re: Enter and Exit Vehicle
« Reply #3 on: May 21, 2010, 12:57:32 PM »
the projects (and the whole 3dRad) closes unexpectedly when I try to open it... ::)

using 6.43
Logged

chebob69

  • 3D Rad Guru
  • *****
  • Posts: 1091
    • WWW
Re: Enter and Exit Vehicle
« Reply #4 on: May 21, 2010, 01:05:42 PM »
That'll be cos ur using 6.43  ???

There are quite a few bugs archangel! The camera when you switch back to the player is a bit jumpy, he walks straight through the car from startup and when departing the car at different heights, the player sometimes hovers in the air!

Why don't you just work from the version I did in that other thread? I thought that was bugless..?
Logged
TexGen - an open source terrain texture generator.
http://www.3drad.com/forum/index.php?topic=4128.0

electron_theory

  • 3D Rad Guru
  • *****
  • Posts: 771
    • WWW
Re: Enter and Exit Vehicle
« Reply #5 on: May 21, 2010, 01:48:46 PM »
Yes, that would be the reason, This requires .46

psikoT

  • 3D Rad Guru
  • *****
  • Posts: 1118
  • I love this shit!
Re: Enter and Exit Vehicle
« Reply #6 on: May 21, 2010, 01:53:16 PM »
Yes, that would be the reason, This requires .46
then you can expect some feedback only from donors ??? ;D
Logged

electron_theory

  • 3D Rad Guru
  • *****
  • Posts: 771
    • WWW
Re: Enter and Exit Vehicle
« Reply #7 on: May 21, 2010, 02:08:32 PM »
Chebob,  That was something I whipped up in a few seconds just to demonstrate Entering/Exiting the vehicle.... I did not bother to iron out the camera or the controls beyond what is basic in 3drad...  To see everything properly working in a project, check here...(I could have used yours, but that would defeat the purpose of doing it mostly myself :))

http://www.youtube.com/watch?v=CXXQ79k93pg

the camera and the controls in the example file feel wonky because the camera translation is set very low by default...
« Last Edit: May 21, 2010, 02:24:01 PM by archangel »
Logged

chebob69

  • 3D Rad Guru
  • *****
  • Posts: 1091
    • WWW
Re: Enter and Exit Vehicle
« Reply #8 on: May 22, 2010, 01:32:51 AM »
Lol, you did ask for feedback! I find it's more helpful to be honest than to be nice.
Logged
TexGen - an open source terrain texture generator.
http://www.3drad.com/forum/index.php?topic=4128.0

psikoT

  • 3D Rad Guru
  • *****
  • Posts: 1118
  • I love this shit!
Re: Enter and Exit Vehicle
« Reply #9 on: May 22, 2010, 04:35:18 AM »
I find it's more helpful to be honest than to be nice.

some people could be very sensitive(?)... specially those who wants third party opinions...
Logged

electron_theory

  • 3D Rad Guru
  • *****
  • Posts: 771
    • WWW
Re: Enter and Exit Vehicle
« Reply #10 on: May 22, 2010, 10:35:51 AM »
Nah, It's all good.   If the issues with the project overshadow the demonstration, then it's not a good demo... I took about 5 minutes to throw it together, then about 10 seconds to test :(.   Justed wanted to demonstrate that the code works... I was rather proud of that :D   

Perikiller

  • Newbie
  • *
  • Posts: 4
Re: Enter and Exit Vehicle
« Reply #11 on: May 23, 2010, 03:48:49 AM »
Can you show some video tutorial? please ;)
Logged

electron_theory

  • 3D Rad Guru
  • *****
  • Posts: 771
    • WWW
Re: Enter and Exit Vehicle
« Reply #12 on: May 23, 2010, 01:25:51 PM »
Unfortunately, my youtube abilities do not extend beyond screencaps atm,  but the steps are fairly simple:

1.  First I have to assume that you have a project with a functioning character object.  I used Chebob's Advanced Mouse Controlhttp://www.3drad.com/forum/index.php?topic=3605.0
2. Add a vehicle to your project, and attach an EventOnLocation to the vehicle (make sure you set the vehicle as the parent to the EOL)
3. Add a Chase Cam to the project, and set it to follow the vehicle.
4. Add the Above script, then set the relationships as needed, and adjust the OBJ_XX's as necessary to match the commented section.

Poof! You are done...

BTW there seems to be an issue with switching between cameras, so I strongly recommend using some sort of script to control the camera...Chebob's script above works amazingly well... check my youtube vid above to see it in action...

chebob69

  • 3D Rad Guru
  • *****
  • Posts: 1091
    • WWW
Re: Enter and Exit Vehicle
« Reply #13 on: May 23, 2010, 01:43:11 PM »
There shouldn't be an issue when switching cameras. Are you stopping the player cam-chase rather than just hiding it?
Logged
TexGen - an open source terrain texture generator.
http://www.3drad.com/forum/index.php?topic=4128.0

electron_theory

  • 3D Rad Guru
  • *****
  • Posts: 771
    • WWW
Re: Enter and Exit Vehicle
« Reply #14 on: May 23, 2010, 02:09:12 PM »
nope, I'm using iObjectShow/Hide.... my initial assessment is that a non scripted camera takes a second to move from where it was located when it was turned off, to where it needs to be when it its turned back on... That's why it does not seem to be an issue when I use your advanced movement script, because the location of the camera gets hard-coded relative to the character's location... just a guess though...
Pages: [1] 2
« previous next »