Hello everyone (I am a beginner so show patience!) ![]()
I made a ship that sails over the sea. The ship object has a steering wheel and a throttle. Both are as RidigBody with a Box Collider. I then detect onMouseEnter to highlight them, then onMouseExit to restore the color.
I also use onMouseUp and onMouseDown to detect those as a Boolean flag.
In the Update function I then check if the mouse is down and the Input.GetAxis to move the RigidBody to change course or speed.
… it works very well and I am pleased … until the ship (experimental very fast one!) reaches a speed over about 12 meters per second. Then, OnMouseOver and OnMouseDown don’t work anymore, as if … the colliders were not following the ship.
So, I checked this community and read that we should rather use Raycast rather than OnMouseOver. Which I did and it works now when the ship sails at high speed. The object changes color but … onMouseDown still isn’t detected so I can’t manoeuvre.
Since the Raycast routine works, I should then detect MouseDown and MouseUp within those codes but … how?
Is it a way to detect the mouse button up, or mouse button down from an “if ()” statement? Thanks in advance.
Cheers,
Michel