Help with Vehicle entering

Blitz3D Forums/Blitz3D Programming/Help with Vehicle entering

mintybreath(Posted 2007) [#1]
Hey, i am kind of new to blitz3d, and i was wondering. How do you make a game, so that there is a certain area where you have to press a button. For example, i would want to be able to be far away from a vehicle and press enter, having nothing happen, but be close to the vehicle and press enter and get into it. Thanks for the help, i really appreciate it.


b32(Posted 2007) [#2]
Maybe you could use EntityDistance()?
;space
If KeyHit(57) then
  ;close to car
  If EntityDistance(camera, car) < 2.0 then
    ;get into car
  end if
end if



mintybreath(Posted 2007) [#3]
Oh that helps alot. Thank you very much. As i said earlier, i am new at coding, and only know kinda basic code. I was not familiar with the entity distance command. Thank you for your help! :)


puki(Posted 2007) [#4]
Either that or a collision.

What I mean is - let's suppose you want to do this but only when standing by a car door. You basically check for a collision between the car door and a hidden collision mesh (hidden with EntityAlpha) that is parented in front of your character/camera - a bit like pushing an invisible wheelbarrow (If you see what I mean).

The collision method lets you be a bit more specific with relation to doors, etc.