Announcement

Collapse
No announcement yet.

Wind force.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Wind force.

    Hello everyone;

    In my have I have a drone and I want the movement of this drone to be affected sometimes by a wind force. Is there a way to do this?


    Thanks,

    #2
    Yes. You will need to have some kind of wind vector somwhere (game instance, drone actor, a seperate wind actor in your level, ...) And then read the wind vector from within your drone every tick or with a delay. Then you apply the wind vector as a force to your drone.

    Comment


      #3
      Originally posted by WixZ View Post
      Yes. You will need to have some kind of wind vector somwhere (game instance, drone actor, a seperate wind actor in your level, ...) And then read the wind vector from within your drone every tick or with a delay. Then you apply the wind vector as a force to your drone.
      Can you give more explanation about creating the wind actor.

      Thank you for your response.

      Comment


        #4
        Ok. So first create an actor. Call it "WindForce" for example. Inside the actor make a new variable of type "vector". Now in tick or however you want you should change the direction and force. Like so:

        Click image for larger version

Name:	bbe3b10c0f11e2e871440f5593ecfac8.png
Views:	1
Size:	121.4 KB
ID:	1124926

        NOTE: change 2 to -10. Otherwise it will keep accumulating in positive force and will end up being insanely fast. This is a bad randomisation approach as it can still create very fast winds. You should come up with something better. But it's just for the sake of making it work.

        NOTE2: You can also normalize the resulting vector. That will create a force vector that will not go over 1 and under 0.

        Place the windforce actor inside your level.

        Then in your drone actor. Go to beginplay. Connect "Get all actors of class", as class select "windforce". Then drag out wire and type "get". Leave "0" as get input. Out of get drag wire and type "windvector". Promote to variable.

        Then go to tick of your drone actor and apply the promoted variable as a force.

        Should work. Haven't tested it myself, but I think it should work.
        Last edited by WixZ; 03-19-2017, 03:49 PM.

        Comment


          #5
          Originally posted by WixZ View Post
          Ok. So first create an actor. Call it "WindForce" for example. Inside the actor make a new variable of type "vector". Now in tick or however you want you should change the direction and force. Like so:

          [ATTACH=CONFIG]133907[/ATTACH]

          NOTE: change 2 to -10. Otherwise it will keep accumulating in positive force and will end up being insanely fast. This is a bad randomisation approach as it can still create very fast winds. You should come up with something better. But it's just for the sake of making it work.

          NOTE2: You can also normalize the resulting vector. That will create a force vector that will not go over 1 and under 0.

          Place the windforce actor inside your level.

          Then in your drone actor. Go to beginplay. Connect "Get all actors of class", as class select "windforce". Then drag out wire and type "get". Leave "0" as get input. Out of get drag wire and type "windvector". Promote to variable.

          Then go to tick of your drone actor and apply the promoted variable as a force.

          Should work. Haven't tested it myself, but I think it should work.

          Dear WizX,

          The explanation is very clear I will try it.

          Thank you very much.

          Comment

          Working...
          X