I apologize if this has been asked before or if I’m asking in the wrong section. Just let me know and a can move or remove this this post.
Ok so first of all I’m using Playmaker right, I can understand JavaScript. My JS knowledge is weak though.
I currently working on a Idle cookie clicker kinda game as its the most basic kinda of game i could think of.
The main function of the gave is to give the player money when he clicks a button. So i have a 3D sphere for the cookie. It currently work by checking to see if its collider has been entered by a game object with a collider that should follow the mouse, if the collider has been entered then the cookie can be clicked. I’m using the action “Get Mouse Button down” to detect a click, but the action doesn’t care about where is being clicked (Thats why im using the colliders). I figured by doing this I could also animate the cookie while the mouse is hovering.
The problem I’m having comes to tracking the mouse. Currently im using actions to get the mouse’s X and Y positions and then storing them in a variables called Mouse_X and Mouse_Y. The problem with this is action “Get mouse X/Y” store its as value 0-1, so at most the object the suppose to follow the mouse can move ±1 in any direction. I tried multiplying the X/Y variable based off the aspect ratio i.e 16/9, which sort of works but the object doesn’t directly follow the mouse, it always stays closer to the top-right than the mouse does. actually now that i look at it it doesnt even keep a static distance from the mouse.
I’m not really looking a “heres the script” answer, i more would like advise. I am still a noob so i dont know much about Raycasting, but it sounds like it might be a better solution then what im trying right now. So really what I’d like to know is… Is what I’m trying now a decent solution or should a try Raycasting? And what ever it is could you give me some suggestions on how to make work? Thank you so much for you help. ![]()
Also if you have any suggestions about Playmaker or scripting or anything else really, feel free to let me know.