playMaker

Author Topic: Move and Rotate  (Read 2094 times)

SeriousRPG

  • Playmaker Newbie
  • *
  • Posts: 45
Move and Rotate
« on: July 09, 2014, 08:42:28 PM »
Hi,
I am trying to get a character to enter a car and sit down. Not sure the best way to do this. I have an animator with a Sit state, so I can use "Animator Bool" to set the "Sit" parameter and my guy will sit. I can "itween move to" to get the guy to move into the car (in a sitting position), but he is still facing the same direction (ie.parallel to the door, rather than turning and facing the front steering wheel).

How can I achieve a smooth action to get into the car, sit down and therefore sit behind the steering wheel facing the front window?



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Move and Rotate
« Reply #1 on: July 18, 2014, 08:38:06 AM »
Hi,

 typically, you would need a special animation done by the artists and play that when triggering a special collider next to your car door.

 if you want that all programmatically, then you need IK, either using mecanim and then controlling each arm legs and the body itself so that each go and target some predefine positions on the car, or another solution on the asset store like Final IK, but I would not recommand that as it's a LOT of work in both case,.

Bye,

 Jean

600

  • Moderator
  • Hero Member
  • *****
  • Posts: 715
    • Flashing Lights
Re: Move and Rotate
« Reply #2 on: July 18, 2014, 09:13:06 AM »
Hello,

My setup as follows, not finished, but works:)

Character goes to a car, shoots a ray to a door, gets that door as gameObject - tells to open/close.

In the car above all seat I have empty objects(sitting positions with Z facing forward), when Character opens the door, he lookAt the desired seat.

Set CharacterCotroller to disabled, Rigidbody to isKinematic.
Begins animation getting in and while animation plays translate char position to seat pos and while moving lookAt pos changes from Seat position to Seat pos+4 in Z axes so it rotates looking at car's front while getting in.

Last I set the sitting pose 1(driver) or 2(passenger) and parent Character to the Seat.


SeriousRPG

  • Playmaker Newbie
  • *
  • Posts: 45
Re: Move and Rotate
« Reply #3 on: August 04, 2014, 06:32:21 PM »
Hi,

Since I didn't have want to go the IK route, I used some camera tricks to start the automation, fad out the camera, move the guy into the seat (with the CharacterController as described by 600) and faded in the camera.

Thanks everyone!