Help with Custom character and collision

Hi!

Ive recently been making a little game just to get to grips with UE4. Ive taken the 3rd person character template and modified the character blueprint to create an endless runner type game. The issue I’m having is that Ive swapped the standard blue character mesh out for a bike mesh made up from different components. When the bike character goes up and down ramps in a level the bike mesh stays horizontal to the floor and will not rotate up and down as it hits a ramp.
See image below to see what i mean.

I’m guessing this is because of the root capsule component in the character BP.
I have been looking around for a while looking for solutions so that the bike character will actually move and rotate up the ramp.
I came across this thread [link text][2]

And from reading that i tried to add physics to the bike mesh so that it will use the collision of the bike and move up the ramp smoothly.

This worked as in the bike actually detects the ramp properly but as soon as i add any imput to the character it just seems to leave the bike mesh behind :frowning:

Is there any other way of doing this so the bike will go up and down ramps smoothly…or is there something I’m doing wrong?

Would appreciate any help as I’m completely stumped with this.

Thanks,

There are two ways you could rotate the bike to the floor.

#1 - On the physics bike you already have set up, you could constrain its location and it’s pitch and roll, but leave it’s yaw unconstrained.

#2 - You could remove the physics and instead rotate the bike to the normal direction of the polygon below it (using a linecast)

Hope this helps :slight_smile:

Thanks! those two sound perfect i will give them a go now. cheers WarLord :slight_smile:

Hi WarLord i have tried your 1st way of doing it using a physics constraint. And this seemed to work, i tested it on the 3rd person character template. I constrained a box to the player character and when pressing play the box swings around although the problem is when i move the character in game in a direction the physics box stays in the same place and seems to become detached from the character :frowning:

I have also tested a separate BP when i used a timeline to move a box that had a physics asset constrained to it and that worked all fine as the physics asset followed the box around. I think i may put a separate issue in if there’s something unusual going on here :confused:

In the meantime i will look up how to do your second option using a line cast as of now i have no idea how to get that working :smiley:

Haha, you’re welcome :slight_smile:

As for the not following, if you have its physics movement completely constrained, it should follow the player as the physics is a child of the player?

I got the Line cast solution to work and it looks pretty good :slight_smile: it feels a little strange as it looks like the bike really hugs the surface of the floor when going over bumpy terrain.

So ill still try and get the physics solution to work as it will look more natural :slight_smile: How would I constrain the physics movement completely? I’ve added a Physics constraint in the character blueprint and hooked the bike mesh up to the root capsule but it still seems to get left behind. I took a look at the documentation and saw I could lock the linear and angular movement but this doesn’t seem to solve the problem either :confused: Any idea what I’m doing wrong?

Ooops it was because i was hooking the bike up to the Root capsule all i needed to do was attach it to another component within my character blueprint :stuck_out_tongue: woo! thanks for your advice :smiley: