- Home /
Question by
uanmanarmy · Jul 24, 2014 at 12:56 PM ·
objectshake
Is there a way to shake an Object fast?
I made this
gameobject.transform.Rotate(0,0,Mathf.Cos(Time.fixedTime) * speed, Space.World);
but this will just rotate so smoooothh, I want to shake it faster :D
Comment
bigger speed = faster rotation, If you want to shake it randomaly then just set maxSpeed and $$anonymous$$Speed and pick random number from this range like:
gameobject.transform.Rotate(0, 0, $$anonymous$$athf.Cos(Time.fixedTime) * Random.Range($$anonymous$$Speed, maxSpeed), Space.World);
Best Answer
Answer by uanmanarmy · Jul 24, 2014 at 01:34 PM
[Closed]
This solution works for me :D
float AngleAmount = (Mathf.Cos(Time.time * speed ) * 180) / Mathf.PI * 0.5f;
Debug.Log("Rotation " + AngleAmount);
AngleAmount = Mathf.Clamp(AngleAmount, -15 , 15 );
material.transform.localRotation = Quaternion.Euler( 0,0, AngleAmount);
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Destroy GameObject and play sound 1 Answer
A node in a childnode? 1 Answer
C# Non-Static Member Rigidbody2D.MovePosition 1 Answer
Problem with player movements 1 Answer