First person view, upon play, I have my cursor locked to the middle of the screen and hide it. I then used a show image node to display a cursor image in the middle of the screen, right where the hidden cursor is at.
I created a simple schematic with the show image node to change the cursor image to a different one. I attached the schematic to a doorknob using the Interaction Machine with Mouse Over enabled. What I want to do is when I get close to the doorknob and the cursor image in the middle of the screen touches the door knob, to change that cursor image to different one.
The problem is that when I am as close to the doorknob as possible and look at it, my cursor image will not change. But if I step back a little bit and look at it again, that will work. I even set the mouse distance to -1, but it still has the same effect.
Overall, It seems like the mouse over won't work if my player is too close to the object. Do you know why this is happening?
The mouse start types rely on Unity's MonoBehaviour callbacks, i.e. if it's not working when being too close, it's most likely due to Unity's system not recognizing it.
Also, it'd be better to change the cursor using the Mouse Enter start type (and changing it back in Mouse Exit) instead of using Mouse Over, which is used each frame while the mouse is over the game object.
In case you need it, you can also change the mouse cursor using a Change Cursor Texture node.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
The reason why I used mouse over and not mouse enter is because I want it to run every frame. For example, my whole schematic is basically like this:
Change Image --> Wait for input -- Success(Open Door)
I also have a mouse exit type to change back the image.
The reason why I didn't use a change cursor texture is because the cursor will be hidden anyway, so there's no use. I once tried to change the cursor texture, locked it to the middle, but not hide it. This only cause the cursor to flick real fast nonstopped.
Welp, I decided to go with raycast instead. After using makinom for this long, this should be something that I can do it easily, but somehow after spending an embarrassingly amount of time trying to do it, I still only received unsuccessful result. I need your expertise :) I used a tick update schematic attached to the player. In the schematic, I used the raycast node. Raycast Origin set to game object. Distance is 10. Layer Mask set to only Hit Ray. Use Mouse Position enabled. Object is the player with forward direction. I even tried using the screen as the raycast origin.
In the scene the doorknob's layer is set to Hit Ray. But no matter how much I tried, it just won't register the hit. Do you have any idea?
Hm, since it should be coming from the camera, using Screen ray origin should be preferred, but the overall setup might suffer from the same issue the original mouse over had with being too close. You could try setting an origin offset in the raycast node, I think it should be a negative Z value to move the raycast origin backward from the camera...
Alternatively, you could also define a child object of the player (or camera) as the origin of the raycast to ensure it's not too close.
When testing in the editor and pausing the game, how close is the camera or player to the object?
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I tried z offset and having the ray coming from a child object of the player, but it still won't register when the mouse is over the doorknob. The player is pretty close to the doorknob but not quite touching it.
You think you can do a quick test on your end to see if it's a bug with the raycast in Makinom? Using a typical first person controller with a camera attached to the player. A single object in the scene and a tick schematic on the player trying to hit a ray to the object. I would super appreciate it :)
Can you send me a small Unity test project to test it with your setup?
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
For those having a similar problem: If your schematic uses the main camera (defined in the Settings node) and you don't have a main camera in your scene, expect camera stuff not to work :D
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Also, it'd be better to change the cursor using the Mouse Enter start type (and changing it back in Mouse Exit) instead of using Mouse Over, which is used each frame while the mouse is over the game object.
In case you need it, you can also change the mouse cursor using a Change Cursor Texture node.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
For example, my whole schematic is basically like this:
Change Image --> Wait for input -- Success(Open Door)
I also have a mouse exit type to change back the image.
The reason why I didn't use a change cursor texture is because the cursor will be hidden anyway, so there's no use. I once tried to change the cursor texture, locked it to the middle, but not hide it. This only cause the cursor to flick real fast nonstopped.
Welp, I decided to go with raycast instead. After using makinom for this long, this should be something that I can do it easily, but somehow after spending an embarrassingly amount of time trying to do it, I still only received unsuccessful result. I need your expertise :)
I used a tick update schematic attached to the player. In the schematic, I used the raycast node. Raycast Origin set to game object. Distance is 10. Layer Mask set to only Hit Ray.
Use Mouse Position enabled. Object is the player with forward direction. I even tried using the screen as the raycast origin.
In the scene the doorknob's layer is set to Hit Ray. But no matter how much I tried, it just won't register the hit. Do you have any idea?
You could try setting an origin offset in the raycast node, I think it should be a negative Z value to move the raycast origin backward from the camera...
Alternatively, you could also define a child object of the player (or camera) as the origin of the raycast to ensure it's not too close.
When testing in the editor and pausing the game, how close is the camera or player to the object?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
The player is pretty close to the doorknob but not quite touching it.
You think you can do a quick test on your end to see if it's a bug with the raycast in Makinom?
Using a typical first person controller with a camera attached to the player. A single object in the scene and a tick schematic on the player trying to hit a ray to the object. I would super appreciate it :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Edit: Solved it through email. Thanks very very much, Gil.
If your schematic uses the main camera (defined in the Settings node) and you don't have a main camera in your scene, expect camera stuff not to work :D
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!