Quantcast
Channel: Questions in topic: "enter-car"
Viewing all articles
Browse latest Browse all 34

player entering car position

$
0
0
im trying to make the player enter and exit a car. i have it all working good except as the player enters the car the cars position and rotation changes to what the players position and rotation is. i found turning the charactor controller to help the player position exiting the car This is attached to the car object: void enterCar(){ CharacterController cc = player.GetComponent(typeof(CharacterController)) as CharacterController; cc.enabled = false; if(!enteredCar){ enteredCar = true; playerRender.SetActive(false); //this.transform.rotation = player.transform.rotation; //this.transform.position = player.transform.position; player.transform.rotation = this.transform.rotation; player.transform.position = this.transform.position; this.transform.parent = player.transform; } else { enteredCar = false; this.transform.parent = null; player.transform.position = player.transform.position + new Vector3(0,0,-3); //player.transform.position = new Vector3(-3f,0,-3f); //player.transform.TransformPoint(Vector3.back); playerRender.SetActive(true); } cc.enabled = true; }

Viewing all articles
Browse latest Browse all 34

Latest Images

Trending Articles



Latest Images