# Setting angle

0 favourites
• 10 posts
• How to set angle towards another object angle?

i mean in physics

<img src="http://dl.dropbox.com/u/44710358/angle.png" border="0" />

'arr' is directional arrow

• toward(arr.X,arr.Y)

• Now the ball is moving in the direction of 'arr', and my point here is that the ball followed where the arrow points

When arrow rotate, ball are turning

• Apply Physics force 4 at Angle (Arr.angle) at image point 0

• WORKING THANK YOU :D

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Yann i have another question if you dont mind

<img src="http://dl.dropbox.com/u/44710358/grav.png" border="0" />

what's wrong here?

• what is the "directionOfShoot" object ?

you need to put an angle, if you want to get an angle from coordinates you need two points. the "from" point and the "to" point

then to get the angle the formula is angle(from.x,from.y,to.x,to.y)

Here you're just putting an x and y coordinate separated by a coma, that's not something c2 understands

• "directionOfShoot" its a sprite, when i shoot a ball, the ball should always fly to "directionOfShoot"

And this ball should be pushed by 'wind' (angle of "arr")

• if I understand correctly you have 2 components :

• shooting direction
• wind force

if it's correct, I think you should do something like

``````on Shot
-> Ball apply impulse  shotStrength   at angle angle(ball.x,ball.y,directionOfShoot.x,directionOfShoot.y)``````

and for the wind

``````Every ticks
-> Ball apply force windStrength at angle windAngle``````

shotStrength, windStrength and windAngle are values you have to figure out.

• i do something like that, what you think abaut that?

dl.dropbox.com/u/44710358/Goal/index.html

• 10 posts