- Home /
How to replace the mouse with a 3D model?
Hi, I want a character to be where the mouse position is. Is there a way to hide the cursor and put the character there instead? He's a 3D model with an animation. In JavaScript if possible, thanks!
Answer by IgnoranceIsBliss · Jan 24, 2012 at 09:39 PM
Off the top of my head, I'd imagine you would use Input.mousePosiiton and Camera.ScreenToWorldPoint - this will tell you what point in your world the mouse is looking at.
Remember that this won't include the DEPTH as such - you'll need to figure that out yourself. But by turning the cursor off, you would be able to effectively replace the mouse with a 3D model.
NOTE: If you are trying to actually make a replacement CURSOR rather than just placing an object in your scene based on the mouse, you may have issues - when it gets near the edges of the screen you may find that perspective becomes a problem unless you are using an orthographic camera. It may be better to use GUI to draw a sprite instead.