- Home /
Left Click Script Problems
So i was working on some code and ran into a problem
So the problem i received was unexpected symbol && in my code.
public bool DidUserClickLeftMouse(Vector3 hitPoint)
{
float clickZone = 0.8f;
if(
mouseDownPoint.x < hitPoint.x + clickZone && mouseDownPoint.x > hitPoint.x - clickZone)&&
mouseDownPoint.y < hitPoint.y + clickZone && mouseDownPoint.y > hitPoint.y - clickZone)&&
mouseDownPoint.z < hitPoint.z + clickZone && mouseDownPoint.z > hitPoint.z - clickZone)
)
return true; else return false;
}
Any Help would be appreciated.
Comment
Best Answer
Answer by Andres-Fernandez · Apr 28, 2014 at 01:40 PM
The parenthesis are incorrect (you were missing some). Try setting them like this:
public bool DidUserClickLeftMouse(Vector3 hitPoint)
{
float clickZone = 0.8f;
if(
(mouseDownPoint.x < hitPoint.x + clickZone) && (mouseDownPoint.x > hitPoint.x - clickZone)&&
(mouseDownPoint.y < hitPoint.y + clickZone) && (mouseDownPoint.y > hitPoint.y - clickZone)&&
(mouseDownPoint.z < hitPoint.z + clickZone) && (mouseDownPoint.z > hitPoint.z - clickZone)
)
return true; else return false;
}
Your answer
Follow this Question
Related Questions
Character Not Rotating 0 Answers
error CS8025: Parsing error 1 Answer
C# Track Mouse Cursor Movement Speed 2 Answers
Problem With Player Looking At Mouse Position 0 Answers
C# Emit Particle Upon Left Mouse Click 2 Answers