x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Problem Adjusting CapsuleComponent for My 2DCharacter

I'm in a rather unusual situation. Normally, In the blueprint of a typical 2D game, the sprite is put within a root default CapsuleComponent which we can adjust its Half Height and Radius. Also the camera is usually set to an Orthographic perspective in order to conceal the fact that the character with its fat CapsuleComponent is adjusted way in front of the background:

capsulecomponent2d

My problem is that in my game the camera is in the Perspective (not Orthographic) mode and I really need to make CapsuleComponent almost as thin as as the sprite itself (Its ok if the CapusleComponent is a bit thicker). If I adjust the Radius of CapusleComponent to match the Sprite thickness make, the CapsuleComponent becomes to unusual to detect collisions of the character properly:

capsulecomponent2d

One solution that I thought about was to add a BoxCollision like this

capsulecomponent2d

But the problem is that the Collision doesn't work no matter what is the value of CollisionPresets or even if I disable the CapsuleComponent collision still it doesn't recognize collision of the box. Why the box collision doesn't work?

Product Version: UE 4.8
Tags:
more ▼

asked Aug 04 '15 at 05:32 AM in Blueprint Scripting

avatar image

boomandbewm
13 2 5 9

avatar image piXelicidio Aug 04 '15 at 01:40 PM

I don't get why you need the capsule so thin. Please explain a bit more to see if there is a workaround to achieve the same results you want.

avatar image boomandbewm Aug 04 '15 at 01:50 PM

It's by design. If I make the capsule bigger it collides with the background wall. I want to achieve a 2D feel on a 3D wall with a perspective camera. If it was Orthographic it would have been easy. I just had to move the character to the front and it would have look liked on the wall but I cannot do that.

avatar image piXelicidio Aug 04 '15 at 02:12 PM

Hmm.. I think i get it now. What about some of this possible solutions after making the capsule bigger: - Disabling collision for background wall? - Making the character sprite displaced far from the center of the capsule, so the capsule don't collide with background wall while the sprite will be close to the wall? - Having invisible objects for collisions with adequate distance each other to work well, while the sprites are child components of this invisible colliders and all get show close in your 2D wall?
- Out of ideas :)

avatar image boomandbewm Aug 04 '15 at 02:23 PM

You are a genius man. Your first suggestion is spot on. Disabling the collision for background seems to work for now. I hope it doesn't lead to more complex scenarios. Your second suggestion is not applicable because when there character rotates in opposite direction it rotates around the center of the CapsuleComponent which would make the sprit further from the wall. Isn't your third suggestion is what I'm trying to do with that box collision? Anyway, Thanks a lot for help. I think we should mark this answered. Can I pick your comment as answer?

avatar image piXelicidio Aug 04 '15 at 02:37 PM

haha.. not genius just making my 2D game and I have facing many related issues... I'll copy the suggestions to my first answer so you can mark as answered. Good luck!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I tundestand that currently characters only support capsules. Any other shape of collision will make other dynamic objects bounce from that collision object but it will not block or control character movement, only the capsule control the movement. I have character that use the capsule for movement, while using the sprite collision shape to bounce objects that fall over it.

Edit:

Hmm.. I think i get it now. What about some of this possible solutions after making the capsule bigger: - Disabling collision for background wall? - Making the character sprite displaced far from the center of the capsule, so the capsule don't collide with background wall while the sprite will be close to the wall? - Having invisible objects for collisions with adequate distance each other to work well, while the sprites are child components of this invisible colliders and all get show close in your 2D wall? - Out of ideas :)

more ▼

answered Aug 04 '15 at 01:39 PM

avatar image

piXelicidio
699 32 37 151

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question