Why does my game break when standing on landscape but not when standing on a mesh?

Hello everyone, I’m creating a game where the player transforms into a ball with physics, and then back into the player with the press of a button.

I have it working great, except when I transform on the landscape. it breaks the game with the runtime error:

When standing on a static mesh, it works with no issues.

Level blueprint:

CharacterB (ball) blueprint:

Hey @Chayes94!

Try implementing this inside your level blueprint :blush:

And here’s the result:


Something extra :star_struck:

I used a separate blueprint as the camera to avoid inconsistency between the characters.

To do that, create a Camera Actor blueprint class like this:

Adjust the camera’s location from the Details window like this:

And set up the Event Graph like this:

Hope these help! :innocent:


Hold on… I just went on writing these without checking your approach and it seems like everything’s exactly the same! :rofl:

Interesting, tested mine not only on a simple landscape but on very deformed ones as well and didn’t encounter any issues.

:thinking:

1 Like

Yes, you were who I got the code from originally! :joy:

So the landscape doesnt cause problems for you? Maybe I should start over on a clean slate?

I’ve uploaded another video. As you can see there is no problems as long as the character is in the air, so I was trying to create some code that could spawn character A slightly above the ground, to avoid collision problems. But, I am failing miserably. Using AI chatbot can only go so far for me. But maybe this isnt the solution.

I think im going to restart on a clean template, given you have no issues I must have messed something up

1 Like

Still works :rofl:

So I was wong and it works sometimes if the ball is rolling a little bit. I have never been more confused!

The only difference I can think we have, is my jumping mechanic for the ball. But I dont see how that would cause issues like this, it happens without jumping

So weird

I also noticed, it seems you’re not controlling the ball when you spawn it. Could this be a clue?

Nope :confused:

I fixed it!! The problem was the the size of my characters collision capsule. I think it was causing the player to spawn inside the ground. So I made my capsule and player smaller, and the problem is 98% fixed. It still happens sometime when I swap to my full sized character on a slope, but its difficult to recreate.

So, hopefully this problem never rears its head again and I can continue developing my game :grin:

Just need to transfer momentum from my character to the ball, shouldnt be hard to figure out! I know its not a whole lot but I learned a lot from your code (including how to organize it :joy:)I almost feel like I’m not totally brand new anymore

Yep, just as I thought the issue was not about the character’s capsule component, but rather the physics ball.

I was able to reproduce the issue when moving the root of the pawn with the sphere static mesh so that the camera follows the ball like it does to the character.

Here’s the fix :innocent:

Just spawn the character a lil higher!

And you can move the root with the ball like this:

I must be doing something wrong :joy: :sob:

The camera is following the ball now, but I have no control over it. And when I press Q again things really break.

level bp
sphere bp
camera bp

I dont quite understand what exactly is going on here at all!!!

Why did changing the ball to a pawn instead of a character cause all of these camera issues?

Hey @Chayes94!

I found out that we might need to increase the spawn height even more when switching characters on steep surfaces. But that wouldn’t look really nice when switching on normal surfaces. So I came up with this! The actual fix that we needed to implement from the very beginning is commented:

But I also went ahead and added some extra features :wink:

One of which is spawning the character right at the surface height to prevent it from sliding on Z axis 'till it reaches the correct height.

(The value 90 there in the subtraction and the addition is the capsule half height of the character we’re about to switch to.)

This is a collapsed graph. I’ll tell you where to place it in a minute.

The other extra feature is preventing the ball from increasing velocity on air.

(Multiplying by 50 comes from dividing 100 by 2. We’d multiply by 100 to convert scale unit to distance unit, and then divide it in half to reach to our static mesh’s bottom from it’s center. But instead we just multiply it by 50. Once that’s done, subtracting 1 from the result would suffice but I subtracted 5 to have a little margin.)

This is also a collapsed graph, and the other collapsed graph inside is our previous collapsed graph.

You trigger these every tick. Now for the first implementation to actually matter, we set the ball pawn’s location according to the determined spawn height on Event Unpossessed like this:

And for the second feature to take effect, place a Gate node right after the Triggered pin of your movement IA. Here you can also see how I handle our pawn’s movement:

(Negating the X component of the action value is due to your orientation. Fellas who leave the forward movement key (W) as it is, negate the backward movement key (S), swizzle the right movement key (D), and both swizzle & negate the left movement key (A) would need to make the necessary adjustments before rotating the input vector. For reference both the OP’s and the setup above swizzles W, swizzles & negates S, leaves D as it is, and negates A.)


To keep everything together, I wanned to include the camera BP’s Event Graph as well (even tho already shared in a previous post above) as the third extra feature:

Also don’t forget to assign the IMC on Event Possessed and add controller yaw & pitch input with your IA like this:


And here’s the final result :star_struck:

Enjoy :innocent:

Incredible!! I was trying a completely different method to achieve this (also failing) when you came back with this. :grinning_face_with_smiling_eyes: I have started over again on a new template.

Right now I am trying to just get the intital BP in place. Where the character spawns 5 feet above the surface. I don’t think its working for me :frowning: (edit below :grin:)

Even before adding the awesome extra features (prevent sliding, increasing air velocity) it should work normally on flat surfaces correct? This is all I have so far

The character doesnt seem to be spawning above the surface, even after setting the number from 5 to 50.

Did I set this up right?

EDIT: No I didnt :joy: :joy: I got it right now. (I wasn’t using the correct get variable LMAO)

Going to start working on the extra features!

I cannot thank you enough for all your help with this!! @VisAgilis

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.