How could i make a trampoline?

Do any of you have idea of how i could make an trampoline? i dont need the full tutorial, just some of the commands i would need in the blueprint. I just need the command for the object to push the thing touching it away with x force in x direction.

Posted Sep 24, 2014, 2:10 PM UTC

18
ErasioStudent•

...I don't quite follow you.

Technically you only need to take the results from your "Event Hit" and calculate how far you want him to bounce in which direction.

I mean you get the direction, the impulse (you may call this the force of the impact) and the location.

Everything you need to calculate a bounce.

1
MorleyInsane•

Adding on to this --

Everytime the object hits the ground, you want to calculate the energy loss so after each bounce, the ball bounces a little bit less higher.

So basically

loss in energy = (1/2)mv^2 * (1 - e^2 )

where m = mass, v = velocity, and e = the coefficient of 
restitution (how bouncy it is, set this between 0 and 1 with 0 
being no energy loss per bouncy and 1 being complete 
energy loss on impact)    

Use that and solve for v for each bounce and apply it to the object.

I'm not the most competent person in Physics, so this could be slightly wrong or completely wrong, but I would google "how to calculate a bounce trajectory" for possible algorithms. In the meantime I'll try to write a little program to see if I'm write. Message me if you get interested in the results.

1
roller344OP•

I'm new to ue4, but what would the command be for the "bounce", i do know how to make other meshes bounce but not the player.

1
MorleyInsane•

So the "bouncing" you see of objects is just the physics engine at work one those objects. I don't THINK there's a property to adjust their "bounce" but there may be and I just missed it.

But to make a player pawn "bounce", you could cheat and just edit the player controller blueprint detailed in this web page so that when the pawn comes in contact with a trampoline object, it triggers a jump event for the pawn.

I don't know the best way to execute this because checking every collision the pawn comes in contact with sounds like it could lead to some resource problems, but give my idea a try and then look at refining it.

1
roller344OP•

If i make it so the blueprint executes a jump event each time it hits an object, then i cant really make it realistic as the jump height will be the same each time. I was just wondering if there was a command to push the player away or something. If i could make the player a physic object i could make a bouncy physical material for the trampoline. I have tried this but cant get it to work, the player just cant interact with physical materials like a normal physics object,got any ideas on how to get it to work?

2
sinothProgrammer•

There are so many ways to approach this problem. How exactly do you want the trampoline to function? Does it matter how fast you are going when you touch it, or is it a constant height every time? Does it 'eject' you at the same angle every time, or does your approach angle matter?

1
roller344OP•

I imagine something like, getting the players speed at the time he hits the trampoline and adding a % to that speed, but all i need for now is just how i could do the basics, i need some commands to work with.

1