# How do I best randomize a physics angle *Solved*

Just started using Construct 2? Post your questions here

### » Tue Sep 15, 2015 3:22 am

Before I was using a bullet behavior where I could set angle towards position x,y then rotate clockwise random(-a,a) and get myself an easy angle variance.

Now, I am using physics, because the collision of my objects as you could imagine was not having expected results.

Currently, the best i have found, was I am doing
Apply Impulse towards position, using a random(x,y), random (a,b)
X,Y is +40%,-40% of the center point of my map's x coordinate, and a,b is 40% of the maps y coordinate. So I created myself a variance.

Now, the result is, I do have a variance, but it seems to favor the center a lot, I have a decent idea as to why, because I've essentially created a box around my center point as the variance, and the most points actually cross the middle of that area.

So, what would be a better way to actually create a variance for myself like I was doing with the bullet behavior?
Last edited by Prowl on Sun Sep 20, 2015 2:06 am, edited 1 time in total.
B
9
S
1
Posts: 49
Reputation: 551

### » Fri Sep 18, 2015 3:18 pm

have you already tried the "apply impulse at angle" action? I think it will work

PS : personal advice : avoid the physic behavior when you can ! I rarely obtain the expected results
B
8
S
1
Posts: 76
Reputation: 628

### » Sat Sep 19, 2015 6:33 pm

Yeah I figured it out, was a rough time. I just used what I was doing to set the angle of my objects with the bullet behavior, then I would apply impulse at my object.angle. Worked perfectly.
B
9
S
1
Posts: 49
Reputation: 551

### » Sat Sep 19, 2015 6:48 pm

Nice !
Don't forget to add [solved] in the title of the topic
B
8
S
1
Posts: 76
Reputation: 628