0 Favourites

How do I best randomize a physics angle *Solved*

  • 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?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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.

  • Nice !

    Don't forget to add [solved] in the title of the topic

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)