swift502 / Sketchbook

3D playground built on three.js and cannon.js.
https://jblaha.art/sketchbook/latest
MIT License
1.47k stars 389 forks source link

enter vehicle from the other side #26

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hello there,

The character can enter the vehicle from the the other side. I've tried with a method closestSeatToEnter() to check which one between driver/passenger seat is the closest from the character, but it wasn't stable at all. I've kept this method commented, just in case.

It doesn't have animation or transform that transfer him to the driver seat (GTA-style), which is a problem, but I thought it would be a starting point.

swift502 commented 4 years ago

First off, I really appreciate you making a PR, but I'm afraid I want to approach this differently.

  1. I wanted to find the closest viable seat right here, right when you press the F key: https://github.com/swift502/Sketchbook/blob/967dcf164394f55e7966dd5d064d880f5f720bc8/src/ts/characters/Character.ts#L633 closest viable being either the driver's seat or a seat directly connected (via a custom property) to the driver's seat.
  2. We'll also need to find the closest entry point of the seat (e.g. airplane can be climbed into from both sides)
  3. I actually think the "transfer to other seat" animation is present in the animations list, but we still need to create a "transfer left" and "transfer right" character states which will play those animations and switch to and from other character states.
  4. The seat points will need additional Blender custom properites... something like "neighboring seat", or "connected seat" which will point to any seats you can transfer to.

You added a this.passengerSeat property, and I wouldn't probably add that myself. there should always be only one targetSeat, the one towards which you're running to. And I intended for it to be selected when you press the F key like I mentioned earlier.

Tell me what you think. I think I have a very particular idea on how to go about this. But it will require adding character states, modyfying the car model in Blender, then parsing new custom properties and other stuff. Tell me if you feel up to the task, but it's a lot of undocumented things that I know how to do just because I've done them already...

ghost commented 4 years ago

Ok! I wasn't sure how to implement this, you've clarified a lot. Like you said, maybe it would be better if you do it, as you did it already ^^. I forgot that a lot was made on Blender too

swift502 commented 4 years ago

I'll focus on implementing this myself now. 👌