Hi, I’m working on a fun Kart Racer project at the moment. I’m relatively new to unreal engine and visual scripting but I would say my skill level is early intermediate.
I wanted to make a projectile similar to how the green shells operate in Mario Kart.
This would be bouncing off steep > 70 degree walls while climbing or descending anything less than this and maintaining all X/Y axis velocity until it either collides with another destructible or bounces a certain number of times.
I have the projectile spawning from an arrow attached to my player pawns forward orientation at a speed that will always be greater than the players max speed.
The projectile itself is using the static mesh shape_taurus that comes with the engine for the time being.
To this I have added the following components;
ProjectileMovement,
Rotating Movement,
InterpToMovement,
Physics Constraint,
Sphere Collision.
While some of these may not be needed for the behavior I want for this example I do want a master projectile object that will act as the template for the behavioral needs of all of the other projectiles that I add to the game.
I have not done any scripting for it so far as a lot of the functionality I need is already included in these components. However I have been unable to limit the Z axis movement of it. Currently the projectile will bounce in any axis keeping the momentum in whatever angle it bounces. Limiting it’s Z axis movement would stop it climbing the various heights of the level.
Would I be correct in assuming I need to use walkable slope behavior for the object to decide whether it bounces or climbs? How do I get it to stay close to the ground and unable to bounce off it while maintaining it’s X / Y velocity? I tried a Hover component but it doesn’t work in combination with the projectile movement component. Maybe a physics material applied to walls and not floors with hits generating bounces?
Also would I better off using the static mesh for collision detection or would the sphere be more efficient? High accuracy is not important.
Any help would be greatly appreciated. Thank you.
-edit-
Having played around with physics materials I pretty much got the desired effect by having separate physics materials for the wall, floor and projectile. The floor now has 0 friction and 0 restitution with the projectile while the wall has 1 restitution so I get no bounces or friction on the floor now and 100% energy conserving bounces with walls. The only thing left to fix is the projectile ramping into the air off small slopes and lips which I assume can be fixed with walkable slope and some sort of z axis modifier. Still any input welcome here. I assume the above method would have very little performance overhead? I will obviously have to apply these physics materials to all materials in the scene which I would have to have done anyway to get different friction surfaces for the vehicle. Luckily there is a separate variable for friction with tires.
-edit2-
I just thought of a potential future problem for this method. If, in the future I want to combine the static meshes and materials of all static objects in the scene to reduce draw calls, will this method still work?