Creating a Trampoline type object?

I’ve been thinking about how to script a trampoline type object.

I’m just trying to work on my coding by scripting 2D elements and the first one I want to try is a trampoline type object.

For simplicity sake lets just say the player falls or jumps onto the object, the object then sends the player X distance in the air.

I did some messing around and the effect I got looks more like teleporting, it wasn’t smooth. I wouldn’t say I was going in the right direction, I am rather new at this.

What would be a good way to do this?

Like most things in Unity, and programming in general, there’s many ways to do things. It depends on how you have your movement system working.

If you’re using a physics based movement, then the trampoline can probably just use the player’s rigidbody AddForce() to push them upwards and let the physics system do the work. However if you’re manually moving to positions, you may have to send a command to the player movement script, and have it move the player upward, similar to however you trigger a jump.

If you can show your movement code (provided you’ve gotten that far as you mentioned you’re just starting), then we can possibly provide some more specific info.