EDIT : edited the question ORIGINAL QUESTION" How can physics material game object maintain a constant velocity?"
My programing skills are rusty and I am new to Unity. Any help will be greatly appreciated
I have a game object called ball that has a physic material applied to it. I have attached an image of the physics properties. Basically
Bounciness set to 1
Static and dynamic friction set to 0
Friction Combine set to minimum
Bounce combine set to maximum
Its just a breakout clone game.
The ball is a game object with a collider that bounces of the screen. Sometimes when it collides with the paddle it will sometime change its velocity.
FixedUpdate() currently has no code. The ball is moving based only on the physics material that is attached to it.
I know that if I have no physics material then i can call the following code to move the ball.
// this.movementX = this.moveDirX * this.moveSpeed;
// this.movementY = this.moveDirY * this.moveSpeed;
// this.movementX *= Time.deltaTime;
// this.movementY *= Time.deltaTime;
// this.thisTransform.Translate(this.movementX, this.movementY, 0.0f);
However, I don't know how to incorporate that code when there is a physics material on the object.
My objectives are the following..
I want to have a variable that stores the ball's velocity.
I want to make sure I can maintain a constant velocity on the ball.
I want it to double it's velocity or change it's velocity after it collides with the "Speed Power Up" or "Slow Power Up"
Any help would be greatly appreciated.