# why does this not work? why does it not work?

I’m still really confused on why you need this formula, this is only to make something rotate around an object… not to point at or target anything.

Here are some examples I think would be more handy or If you really need this kind of formula, I think there is an easier way to do it.

Point At & Angle to example:
https://flowlab.io/game/play/1313462

Target example:
https://flowlab.io/game/play/1233322

This is the formula you were looking at, I explained more in the Direct Message.
I’ll make a separate calculator for the formula later. I’m trying to translate this to nodes :

function rotatePoint(point, center, angle){

``````        angle = (angle ) * (Math.PI/180); // Convert to radians

var rotatedX = Math.cos(angle) * (point.x - center.x) - Math.sin(angle) * (point.y-center.y) + center.x;

var rotatedY = Math.sin(angle) * (point.x - center.x) + Math.cos(angle) * (point.y - center.y) + center.y;

return new createjs.Point(rotatedX,rotatedY);
``````

@grazer

@murten101 - I’m not exactly sure what the intent is, so I can’t say exactly what is wrong, but one thing that is for wrong is that Math.sin() and Math.cos() return values between 0 and 1. Behavior blocks only output integers, so this means that the output will almost always be 0 (i.e. the decimal portion will be truncated).

It is better to do all the math inside your expression, then return the completed result if possible. You can also scale the result up (e.g. multiply by 100 so 0.12 becomes 12) before returning it.

Here’s an example that might help: https://flowlab.io/game/play/768960

So what is it supposed to do?
Circle the target mark around the player, like this?
https://www.gamefromscratch.com/post/2012/11/24/GameDev-math-recipes-Rotating-one-point-around-another-point.aspx

i updated some stuff amd its doing something but it seems to spawn the object in a straight line from 0,0 to my player (this is not what i want)
@TinkerSmith

@murten101

Math.sin() works with radians, the extract output is degrees.

Radians = Degree x PI/180

A good enough approximation would be Math.sin(A/0.01745)
(pi/180 ~ 0.01745) and yes its a point rotation but i first want to get x working before adding the y but its not working What is it supposed to do? First I thought you try a point rotation around another point, but then you would need to use the Y too.  