Setting angle

Get help using Construct 2

Post » Sat Apr 07, 2012 10:39 pm

How to set angle towards another object angle?
i mean in physics


'arr' is directional arrowkataryna2012-04-07 22:40:15
B
170
S
3
G
2
Posts: 65
Reputation: 6,057

Post » Sun Apr 08, 2012 12:28 am

toward(arr.X,arr.Y)
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Apr 08, 2012 1:19 am

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 turningkataryna2012-04-08 01:39:08
B
170
S
3
G
2
Posts: 65
Reputation: 6,057

Post » Sun Apr 08, 2012 9:11 am

Apply Physics force 4 at Angle (Arr.angle) at image point 0
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Apr 08, 2012 9:36 am

WORKING THANK YOU :D
B
170
S
3
G
2
Posts: 65
Reputation: 6,057

Post » Sun Apr 08, 2012 11:04 am

@Yann i have another question if you dont mind


what's wrong here?

B
170
S
3
G
2
Posts: 65
Reputation: 6,057

Post » Sun Apr 08, 2012 11:20 am

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
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Apr 08, 2012 11:27 am

"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")kataryna2012-04-08 11:40:05
B
170
S
3
G
2
Posts: 65
Reputation: 6,057

Post » Sun Apr 08, 2012 5:40 pm

if I understand correctly you have 2 components :
- shooting direction
- wind force

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

[code]on Shot
-> Ball apply impulse shotStrength   at angle angle(ball.x,ball.y,directionOfShoot.x,directionOfShoot.y)[/code]

and for the wind
[code]Every ticks
-> Ball apply force windStrength at angle windAngle[/code]

shotStrength, windStrength and windAngle are values you have to figure out.Yann2012-04-08 17:41:14
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Apr 08, 2012 6:18 pm

i do something like that, what you think abaut that?
http://dl.dropbox.com/u/44710358/Goal/index.html
B
170
S
3
G
2
Posts: 65
Reputation: 6,057

Next

Return to How do I....?

Who is online

Users browsing this forum: linkman2004 and 19 guests