2
$\begingroup$

So my character (character physics) will be traveling through the level and I want him to be able to jump into a cannon of sorts, and when a button is pushed, he gets fired upwards along a parabolic path to another platform to make the level more interesting. I've tried making an invisible platform that carries him quickly, but it doesn't work and is really hard to make anyway. I am obviously new to blender, so it feels like there is a very simple solution that I'm just not finding.... Thanks!

$\endgroup$
1
$\begingroup$

Final result:

enter image description here

What's happening

So I have a player, a floor for the player to walk on, a wall to jump over, and a cannon to launch him.

The player has a basic setup: enter image description here

W to move forward, A to turn left, S to move backward, and so on. The motion of the Dynamic player is simply the Location of the Motion Actuator. (You probably have a different setup)

Now, inside the cannon, I added a child cube, that I'm calling inside. It's static and has the cannon as a parent. It's also Invisible and has the Ghost property applied.

enter image description here

The logic bricks

Referencing the above image, when the player comes into contact with the inside cube, the keyboard sensors will activate. When A is pressed, they will activate the cannon's Motion Actuator, that will turn the cannon 2 degrees along the Global Z axis. Likewise, when D is pressed, it will move -2 degrees.

Last of all, when the Spacebar is pressed while in contact with the inside cube, the Player's Motion Actuator is triggered with a force of 800 along the Z axis. Because the cannon is slanted, the player will hit the top of the cannon and will be forced out of the cannon at the same angle. This will not work if your cannon is vertical.

Here is the .blend file:

$\endgroup$
  • $\begingroup$ I will definitely use this. Do you have any idea how to make it so that the cannon will automatically aim and shoot the character so that it lands in a specific spot? I'm gonna need something like that as well. This is pretty great though. ;) $\endgroup$ – DaDudeII Apr 13 '18 at 3:52
  • 1
    $\begingroup$ Create an animation for the cannon when the inside is in contact with the player, so the animation will play and the cannon will move automatically to your desired location. $\endgroup$ – Akados Apr 14 '18 at 4:08
  • $\begingroup$ Oh.... duh. I should have thought of that. Thanks! $\endgroup$ – DaDudeII Apr 14 '18 at 5:21
  • $\begingroup$ I got it to work until I tried it with my character. It's collision cube has character physics, so its motion controls are different and I don't see any "force" option. Any ideas? $\endgroup$ – DaDudeII Apr 21 '18 at 5:27
  • 1
    $\begingroup$ The character physics does not have the force, you'll have to either make your character dynamic or parent your character to an invisible cube that's dynamic. $\endgroup$ – Akados Apr 22 '18 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.