Announcement

Collapse
No announcement yet.

Several questions for making a breakout like game

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

    Several questions for making a breakout like game

    I am trying/learning to create a breakout 2D game with UE4, but my first steps with it was not that successful so far... so i have a few questions:

    1.) How do i apply an impulse in a specific direction to a ball (Unit vector + Magnitude) actor by using blueprints?

    My current approach does not work very well, because it does not bounce off the wall, see the blueprint for the ball:
    Click image for larger version

Name:	ball_blueprint.jpg
Views:	1
Size:	72.5 KB
ID:	1138015

    In other physics engine, i just do "ApplyImpulse" or something like that and the ball starts spinning, or set the InitialVelocity.

    2.) Why canĀ“t i access the velocity from the balls blueprint? Is there some special stuff needed?

    3.) How do i set a custom gravity for specific actors?

    4.) How do i add a force and torque to a actor?

    5.) How do i change the physics body from static to dynamic and vice versa while the game is running?

    Thanks in advance,
    Finalspace
    My youtube channel: https://www.youtube.com/user/F1nalspace

    #2
    Theres alot asked here but ill try and atleast point you in roughly the correct location.
    You might want to try dragging off from your "ball" and type force, select the add force node, make sure the ball has both physics enabled and collision.
    From past experience ive had alot of trouble with add force, sometimes ive literally added a force of 1 million just to get it moving so dont be affraid to increase it.
    Another way could be using the ball as a projectile, i suggest checking out the first person blueprint template and look at the projectile blueprint on how it works.
    and lastly you might want to look into physics materials, these are great for making your object bounce, you should be able to find pleanty of documentation on youtube on that.

    Sorry if this isn't any help at all but best of luck.

    Comment


      #3
      Originally posted by Divinitize View Post
      Theres alot asked here but ill try and atleast point you in roughly the correct location.
      You might want to try dragging off from your "ball" and type force, select the add force node, make sure the ball has both physics enabled and collision.
      From past experience ive had alot of trouble with add force, sometimes ive literally added a force of 1 million just to get it moving so dont be affraid to increase it.
      Another way could be using the ball as a projectile, i suggest checking out the first person blueprint template and look at the projectile blueprint on how it works.
      and lastly you might want to look into physics materials, these are great for making your object bounce, you should be able to find pleanty of documentation on youtube on that.

      Sorry if this isn't any help at all but best of luck.
      I have tried using the physics materials, but this have not worked as i would expect. I gave the floor and the ball a restitution to one and zero friction, so i would expect that ball with applied physics will bounce of forever. But the wall gained more and more momenentum, so it bounces higher and higher.

      I will checkout the firstperson sample and see how the projectile thing works.

      Thanks.
      My youtube channel: https://www.youtube.com/user/F1nalspace

      Comment


        #4
        Ah great i found out, that using the get from the StaticMesh Variable gives me access to add an impulse or an force. Yes.
        Now it will get interesting ;-)
        My youtube channel: https://www.youtube.com/user/F1nalspace

        Comment


          #5
          Good to hear, have a fiddle with the angular damping and linear damping under physics, tweaking these should stop it getting faster and faster.

          Comment

          Working...
          X