Hello there
I´ve created a book that i want to give the user the possibility to click and drag each page. The problem is that my book opens when i move around no matter where i am in the scene because it responds to the mouse movement. I want the book to stay closed before the user gets near it and only opens it when he clicks and drags.
Here´s my code:
public class MegaBook : MonoBehaviour
{
public GameObject front;
public GameObject back;
public GameObject page1;
public GameObject page2;
public GameObject page3;
public List<Texture> pages = new List<Texture>();
public float bookalpha;
public float covergap = 0.0f;
public float pagespace = 0.01f;
public float dragsensi = 1.0f;
public float keysensi = 1.0f;
MegaPageFlip pf1;
MegaPageFlip pf2;
MegaPageFlip pf3;
MeshRenderer mrpg1;
MeshRenderer mrpg2;
MeshRenderer mrpg3;
void SetPageTexture(MeshRenderer mr, int i, Texture t)
{
if ( mr.sharedMaterials*.mainTexture != t )*
_ mr.sharedMaterials*.mainTexture = t;_
_ }*_
* void Update()*
* {*
_ bookalpha += Input.GetAxis(“Mouse X”) * dragsensi;_
bookalpha = Mathf.Clamp(bookalpha, 0.0f, 100.0f);
This is just a bit of the code i`ve made. I did tried to use GetMouseButton instead of GetAxis but then i got this error from this line of code:
bookalpha += Input.GetMouseButton(0) * dragsensi;
operator * cannot be applied to operands of type ‘bool’ and float’
What am i missing here?