Blender GE tutorial request! (How to get in and out of car)

Hello all blender folks! :wink:

I have been searching around for a tutorial of how to get in and out of a vehicle in blender GE, but I just couldn’t find it!
Is there any sort of a tutorial, or some links to a blend file that show how to do that?
(If you don’t know what I mean, I mean a tutorial of how to get in and out of a car, as in GTA, Driv3r etc.)

And I’m really sorry if this has been asked before, but I couldn’t find it! :frowning:

Thanks for all answers! :wink:

A method rather than a tutorial -

step 1 - the player needs to have a sensor (ray/near to detect the vehicle) and the required key sensor, connected to an and controller, this should then make a player’s camera property “0”, call it “Active”, also have a camera actuator connected, this should change the camera to a camera parented to the car.

step 2 - parent the player to the car, using the ghost option on the actuator. make a short (easy) script that places the player at the position of an object (use a “no collision” emptymesh in the driver seat, for example). set the car’s camera’s “Active” property to be “1”.

step 3 - connect a property sensor when “Active” is equal to “1”. Then connect this to ALL the controllers connected with the controls of the player, and the same for the car object. this way, you can only drive the car when your player is in it, and you can only move the player when not in the car.

step 4 - toggle these properties again, and remove the parent of the player (perhaps using another script to place the player at the position of another “no collision” emptymesh, this should be perhaps at the door of the driver’s seat.

not sure of your level so I kept this at (what I hope is) an intermediate level… just describing some of the logic of the way it could work, good luck…

Okay, thanks for a very good answer! :wink:

I’m using the “Vehicle Wrapper” script for the car, so I was wondering if this is going to work with it!
I’ve attached the .blend file if you want to see it and try it!

If someone could help me and send it back it would be really appreciated! :yes:


Gårdmedfarge.blend (874 KB)

It should work with it; if you have it using an ALWAYS pulsing sensor for the wrapper script now, just change it to a pulsing (no delay) sensor on your car’s camera, which is a property sensor for “Active” property equals “1”.

That way, the wrapper will only run when the player is in the car, you may also wish to have an always sensor connected to the script AS WELL, set it to tap, this makes sure that when you start, your wheels are placed, else they’ll only be placed on the car when the player goes into the car and could make the car get stuck in the ground, etc.

Thanks a lot Haker23! :smiley:
I will work with your method! :wink:

Awesome, let us know how it goes. (I made it work, but I was too lazy to finish the player positioning at the seat and door, and the file became way too inefficient with everything else (It had poor materials, no occlusion and too much geometry), so I ditched it)

I’ve enocuntered the same sort of problem, only is there a way of doing this without scripting? I’m just so terrible at coding and would rather use the blocks if possible. If it’s impossible, thanks anyway.

I’m going to finish my .blend level, and then I will try your solution! :smiley:
I will let you know if I have made it :wink: