How to combine 3D world with 2D characters


Like the picture.How to prevent the head of the character from entering the wall?

Hi @hello,

I’d say one easy solution is to increase the size of your player’s collider. That way he won’t be allowed close enough on walls for the head to enter them.

Sorry, what I want to say is that when the character’s upper body enters the building, he can still be displayed on the top. Because the characters are placed obliquely.

Yes, that’s what I thought so the easy solution was to keep the player away from the walls (increase their collider, they will collide further away).

A more complex way would be to split your character 2D graphic to multiple parts: legs, torso, head etc so you have more control of their local position in comparison with the player position (feet pos).

Sadly I am not aware of any example on that.

1 Like

Is the camera orthographic or perspective view. If orthographic, then there are few things that could be done

1 Like

It’s perspective view。

Perspective view is tricky. A way to get around this is to create a wedge shape poly that is wider at the bottom than the top that would when looked at by the camera, would be perfectly straight.

To an example of the shape, it would look like this:

But in the camera, it would be look square

To give a better example, using orthographic as the example, we can have the sprite rotated normally but stretched vertically so it looks normal sized in the camera

https://playcanvas.com/editor/scene/1342111

1 Like