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"

How could I make a ball bounce when on a specific material?

I am attempting to make a ball bounce consistently when on a specific material. This is made in the rolling ball example project, so the player is controlling the ball. I simply want to be able to make the ball bounce continuously when it hits the ground, but I do not want it to bounce off of other objects such as walls or placed props. How would I go about this? Thanks.

Product Version: UE 4.10
Tags:
more ▼

asked Dec 31 '15 at 05:40 PM in Blueprint Scripting

avatar image

Anaklosmos
170 35 29 54

avatar image Jacky Dec 31 '15 at 05:49 PM

First you need to create and set physics materials for your materials, then you need to use the hit result(Hit Phys Mat) of Hit Event or a line trace to the ground and get the physics mat of the hit location. You can then use that surface type output and change the behavior of the ball with Switch on EPhysicalSurface enum. Or just create and set physical materials and set the desired Restitution value inside the physical material.

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

1 answer: sort voted first

Create yourself a physics material (or use one of the ones that comes with the engine.) Assign it to the material you use on the floor. When you collide with the floor, check which physics material it is and respond appropriately. This can probably be done inside the physics material itself, but I've not played about with them much.

more ▼

answered Dec 31 '15 at 05:48 PM

avatar image

TTaM
1.7k 80 28 81

avatar image Anaklosmos Jan 01 '16 at 07:57 AM

This is the simplest way that I could figure out, however, the ball bounce height is not always consistent. This height depends on how high the ball previously was, so falling off of a small ledge will cause the ball to have very short bounces and falling off of a high ledge will cause the ball to have rather large bounces. Is there a way to regulate the height of the bounce while still just using a physics material?

avatar image JDuaneJ Apr 22 '16 at 12:41 AM

Hey guys, I would love a technical explanation of how you setup the BP for the surface. I'm making a trampoline and I started just applying an impulse to any actor that collides with a box component, but that's pretty much a hack. I'd like the surface to react differently depending on the colliding actors phys_mat properties.

I'm currently getting the physical material of the colliding actor, then grabbing it's restitution to multiply it with the trampoline's fabric phys_mat - the result is then multiplied by the colliding actors density and fed into the impulse.

Is there a better way to do this? I assumed physical materials would respond physically accurate with any physics object without the need for an impulse.

Thanks!

(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