- Home /
Image Rotate Gallery Snap
Hi guys.
I have Image Rotate Gallery in my game.
I have a Script for my Image Rotate Gallery
public int speed;
public float friction;
public float lerpSpeed;
private float xDeg =0f;
private Quaternion fromRotation;
private Quaternion toRotation;
// public GUIText guiText;
void FixedUpdate ()
{
if (Input.GetMouseButton (0))
RotateTransform (Input.GetAxis("Mouse X"),0f);
else
RotateTransform (0f, 0f);
}
void RotateTransform (float xNum, float yNum)
{
xDeg -= xNum * speed * friction;
fromRotation = transform.rotation;
toRotation = Quaternion.Euler(0,xDeg,0);
transform.rotation = Quaternion.Lerp(fromRotation,toRotation,Time.deltaTime * lerpSpeed);
}
}
And this is my Script for my Snap. this is "Image Snap"
void OnTriggerStay(Collider Category)
{
if(Category.gameObject.tag == "P1")
{
CarouselRotate focus = GameObject.Find("Carousel").GetComponent<CarouselRotate>();
//rotate local the carousel here base on the image category that hit in the collider
//
}
my problem is when the the image in the category is collide to "Image Snap". i want to rotate the "image rotate gallery" to center the current image that collide in the "Image Snap"
Comment
Your answer
Follow this Question
Related Questions
Rotate Z axis of object to camera 2 Answers
Rotate exactly on time 1 Answer
Accelerometer RotateAround player 0 Answers
Based on touch rotate camera object 0 Answers
Smoothly Rotate the Object 0 Answers