Question about Character Collision and moving the CapsuleComponent

Hi there!

I have been trying to solve a issue for a few days now but im not getting anywhere. I have tried many different solutions and as i am an Artist by trade i don’t have so much experience with Programming so there is probably a better way to solve this issue but anyway! So i have been trying to make the basic controlls for my simple game idea where the goal is simply that you have to get up to the top of a tower from the inside, the plan is to have a sort off’ish 2D camera layout but the thing is that cause the tower is round i want the player to move in a circle and the camera to follow him. To better explain here have my amazing presentation skill:

To solve this issue i changed the character model and offset him on the X axis but keeping the Pivot point in the middle and later when player is pressing A or D “Left or Right” the Z axis rotates. This gave the effect i wanted that the player moved in a circle. The problem now appeared tho. The collision didn’t follow with the modell and the collision in this case is the “CapsuleComponent” and it’s unmovable. This means that the collision is where i have placed the camera and the character wont get any collision at all. I have tried to make a new Sphere shape to use as collision but it refuses to read it, it simply ignores it and either it’s the CapsuleComponent’s Collision or no collision at all. Here is a image showing what i mean:

So my question is do you fellas have a tip of how i can change the position of the CapsuleComponent or making it understand that i want my new Capsule to be the collision? Or is it a way to add collision to the Character Mesh? Or should i change tactic and approach the rotation in another way? I tried some other methods with Blueprint but nothing so far have worked :confused:

Sorry if my explanation sucks btw tired and it’s difficult to explain what i am trying to achieve haha!

Cheers!

What you would likely want to do, is create a custom (and very simple) C++ class, which would be very similar to the ‘Character’ class but have a dummy component, such as an invisible mesh (or even use the ‘scene’ component).

You might not actually have to create a custom class at all, you may well be able to add the components in the character class to a custom Blueprint class which has a ‘Default Scene Root’ component. You could then offset the capsule, and have the dummy component at the center of your tower. Try creating a custom blueprint class just based on the ‘actor’ class, and add the same components as your custom blueprint has shown above.

The alternative option I think, would be to use an animation with root motion, I’m not much of an animator though so can’t help you there :slight_smile:

“You could then offset the capsule” That’s the thing i can’t move the capsule. That’s what creates the issue with the Collision because the Capsule controls the collision and it’s not possible to move it. Thanks tho!

In your example, you can’t offset the capsule because it’s the ‘ROOT’ component, meaning that everything is based around the capsules location. You can offset the collision capsule if it’s NOT the root object of the blueprint, so you’ll need to create a new class blueprint and use a dummy object as the root component, then make the capsule the child of this component. You will then be able to offset it :slight_smile:

Oh i see! I will try this out right away! I’ll report back if it works or not! Thank you so much! ^^

And oh another question! Which Parent Class should i choose? If i create a Character Class it makes the capsule to “ROOT” component automatically :confused:

Choose the ‘Actor’ as a parent class, I’m fairly sure you can then add the rest of the components from the drop down box.

If not, a simple C++ class would give you what you need. I can’t do it right now, but I might be able to post one back in the next couple of days if you have no luck :slight_smile: it would just be a simple modification of the ‘Character’ class, and add a dummy component as the root component :slight_smile:

Hmm when i choose Actor class it seems that the player isn’t able to “Possess” this blueprint and cause of that i can’t make so the player can control this blueprint it seems? Btw you don’t happen to have skype or steam or something similar? ^^ Easier than communicating through here :slight_smile:

Edit: Hmm i tried using a Pawn class instead cause that is possessable but i stumbled upon another issue instead that now the “Character” Category isn’t available which makes so my character mesh cannot jump :confused: And the collision still wont work :confused:

I think you do want to use a Character, as you will want all the walking/jumping/climbing logic. I don’t think your approach of offsetting the capsule component will work though. As was mentioned above, you cannot move the root component, and the Character class assumes that it is centered on the origin. What you might want to try is:

  • Take a look at the third person template. There you can see how the code maps the inputs to the direction of movement. In that example it is relative to the camera, but you could make it relative to your position in the tower, so input always causes you to move around the tower.
  • MovementComponent has options to constrain movement to a plane (bConstrainToPlane, PlaneConstraintOrigin, PlaneConstraintNormal, bSnapToPlaneAtStart), it might be possible to update these each frame to keep the pawn on a cylinder instead.
  • You may need to add some ‘blocking volumes’ into your level. These are ‘invisibile walls’ that you can use to keep the player in a particular area (e.g. on the cylindrical staircase)

Thank you for the tips i have tried with making the movement relative to the camera location but no success yet. I have played around with many different solutions to this issue but nothing have worked so far. Soon i think i have to maybe put this idea on the shelf and come up with something different but i don’t want to give up just yet! If someone have any ideas how to solve this issue or maybe take a different approach i am very greatful for sharing!

Bump! Still having this issue and cannot for the world figure out a fix for it. I am now using a separate Cinematic camera instead tho and trying to come up with a way for the character to rotate around the camera instead of moving the collision node because that is confirmed that it wont work.

“Sorry if bumping is not allowed, i checked the rules and there was nothing about it in there so… ^^”

Hi Johan3043,

If you don’t mind, please post toanswers.unrealengine.com in the “Using Unreal” section if you are still having trouble so we can more easily assist you. Thank you and have a great day!

I have a questions in the help section, please help :eek: