x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

2D Sprite not detecting Collisions

I am trying to create an Arkanoid clone to familiarise myself with the engine and C++. I currently have a paddle that can move right and left. I am using a variable called Current Velocity to move the Paddle along the axis

 CurrentVelocity.X = FMath::Clamp(AxisValue, -1.0f, 1.0f) * 300.0f;

The problem is, when the Paddle comes to the borders, it doesn't detect that they're there. it just passes straight through them. This can be solved by enabling the 'Simulate Physics' checkbox, if I enable it at runtime, the Paddle can move and it will detect the borders but when I make the changes in the Paddle blueprint and play, the Paddle doesn't move anymore.

Here is the blueprint of my Paddle alt text

Can anyone point me in the right direction to get my Paddle detecting collisions?

Thanks in advance.

Product Version: Not Selected
Tags:
paddle.png (473.7 kB)
more ▼

asked Apr 14 '18 at 10:28 AM in Everything Else

avatar image

JayFitz91
1 3 1 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

In case anyone was wondering, I decided to simulate physics on the Paddle and use the AddImpulse() function to move it instead:

 float MovementDirection = PaddleInput.MovementInput.X;
 FVector Pos = GetActorLocation();
 Pos.X += MovementDirection * PaddleSpeed;
 PaddleSprite->AddImpulse(Pos * PaddleSprite->GetMass());

The paddle now collides with the borders as well as the ball

more ▼

answered Apr 17 '18 at 12:47 PM

avatar image

JayFitz91
1 3 1 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question