- Home /
Flying back in car seat
So yeah, when I speed up in my car my guy (tic-tac man) goes further and further into the seat despite me setting his position to the seats position each frame. Here is the code at which the position of my character is changed:
void FixedUpdate () {
if(carControlEnabled){
seatTarget = seatPos.transform.position;
player.transform.position = seatTarget;
player.GetComponent<CharacterController>().enabled = false;
player.GetComponent<FPSWalkerEnhanced>().enabled = false;
player.GetComponent<CapsuleCollider>().enabled = false;
Controller();
HandBrake();
} else if(!carControlEnabled){
wheelRR.motorTorque = 0;
wheelRL.motorTorque = 0;
wheelRR.brakeTorque = decelerationSpeed;
wheelRL.brakeTorque = decelerationSpeed;
wheelFL.steerAngle = 0;
wheelFR.steerAngle = 0;
}
}
I have included the full statement in-case you were wondering if anything else could be causing this, if you require some screenshots then just ask me. seatTarget just gets the vector position from the seat GameObject.
Answer by bubzy · Oct 10, 2014 at 05:16 PM
if the player doesn't need to fly out of the windscreen or anything, you could consider disabling the rigidbody whilst in the vehicle. this should alleviate the problem
The fps controller does not have a rigidbody attached to it.
if you are using the character controller asset, then yes it does. its just not visible :(
How are you meant to disable something that's not visible, and im not using the default character controller.