- Home /
Kinect issue with Character Movement while in flight
Hello, I'm creating a game where the character is flying using Kinect over the terrain and deforming it at the same time. While the terrain deforms, the character should always stay over the terrain, but as terrain deforms abruptly, the character updates its position abruptly as well creating motion sickness. I need to be able to update the position of the character in a smooth way, so that the flying becomes a satisfying experience. Any thoughts??? here's my code:
transform.Translate(Vector3.forward * (movementSpeed / 2) * Time.deltaTime);
float height = 0;
Vector3 terrainPos = Vector3.zero;
terrainPos = transform.GetComponent<ViewHelper>().underHit.collider.gameObject.GetComponent<Terrain>().transform.position;
height = transform.GetComponent<ViewHelper>().underHit.collider.gameObject.GetComponent<Terrain>().SampleHeight(transform.position);
transform.position = new Vector3(transform.position.x, terrainPos.y + extraHeight + height, transform.position.z);
Comment
Your answer
Follow this Question
Related Questions
Infinite Runner Movement 2 Answers
My character won't move on premade terrain 0 Answers
Can I prevent player through terrain when terrain height is modified at runtime? 1 Answer
Click to Move problem with hills 3 Answers
Character Rotation 2 Answers