Make Object Point towards Cursor


Hello! this is my first post so please bear with me. I have an object that I want to have point at the mouse cursor, but I also want it to stay at the same X/Y cords. Any idea how I would go about doing that? Thanks, Lakeside

1 Like



This is actually something I’ve been meaning to do for a while, so I just now added a function called pointTo for making this easy.

Add this code to a wick object and it will point towards the mouse~

function update() {
    this.pointTo(mouseX, mouseY)


Thanks! I am actually doing a project to show what I am able to do to the
Entertainment Technology Center of Carnegie Mellon University! I will be sure to tell them that you helped! Thanks, Lake



Sweet! Feel free to post any projects you make on the forums, would be cool to see!



In Wick 1.16.1 pointTo() does not work (error: this.pointTo is not a function). Instead, I use this code: (link)

onEvent('update', function () {
    pointTo(this, mouseX, mouseY);

function pointTo(obj, loc_x, loc_y) {
    angle = Math.atan2(loc_x - obj.x, - (loc_y - obj.y) )*(180/Math.PI);      
    obj.rotation = angle;
1 Like


is pointTo() even a function in the list of builtin functions? I don’t see it anywhere.



It might have seeing zrispo said it (Probably in legacy). And got removed in future update

1 Like