Hello everyone! I’m testing an application on an ipad and although I put the walls of the room a collider set to “blockall”, when I try to do swipe and pinch to zoom movements, I still go off the walls and the floor.
In viewport if I enable player collision, I see them, but in the end in app they don’t work.
Can anyone help me?
Hey there @FabianaCarboni! So depending on how your character is setup, there can be a number of reasons collisions aren’t working. May we see your character blueprint and your movement logic?
If your character is a character class and using a capsule, verify that it’s set to block all as well. The character class movement component should block collision with anything that has simple collisions and can collide with the player.
Do your walls have collision meshes?
The project is a charcaterless but first-person touch application, where through swipe motions, one can move within a room.
The walls have collisions in fact if I activate the “player collision” mode in viewport, they color. However, at the time of testing on ipad, if one swipes one can move through walls, floor and even ceiling.
Ahhh there you go, the reason I asked to see your movement setup is because different nodes have different fixes here. I’m going to assume you’re using Add/Set actor location then. If so that node ignores collision when making moves unless you tick the Sweep boolean in it. Though without seeing your nodes you could be moving it a number of ways, though that is the most common.
See the sweep Boolean on the Add Local Offset nodes? Check those on. Sweep checks to see if it will make collision with the movement and then will stop the movement. Most movement nodes come with a sweep bool or it built in.
I set on the node sweep “add local offset” but the colliders still do not work.
That’s odd, mimicking your setup with proper collisions I don’t get the same effect. Are collisions for your collider and the walls set to block all (or at least each other)? Are you using a static mesh or an overlap box on your object?
I’m using a static mesh and this are the settings for the collision.
I tried setting the collision to custom so as to unlock “collision enabled (query and physics)” but nothing.
Interesting! In that PlayerCamera reference is your collision the root component of the object? My test object is just an SM with blockall and moving with add local offset with sweep as well.
This is how the reference is set now.
Should I add the walls and the floor inside? Sorry but unfortunately I’m still new to unreal and have a lot to learn.
Ahhh there we go, That’s the issue. The pawn that holds your camera would need a static mesh/collider as it’s root to be able to take collisions. The walls and floors don’t need to be in the same BP at all, just need something to determine the actual collisions. Right now your camera has no components that can collide (minus the spring arm but that’s only for traces).
So just for now just to visualize the collisions, add a cube static mesh, then drag it to the location where you want the collisions to occur from. If your game is set up how I assume, it’d likely be in front of the camera. Then in the component hierarchy, click and drag the cube to the default scene root, change your local offset to the cube, Save, then test it out. It’s likely blocking your camera view right now but we will disable it’s visuals in a moment, this is just for you to visualize where the collisions are.
After that, set the cube to no visibility:
Technically you could just use box collisions, but the SM is good for showing the collider well while you’re getting it to work well.
Unfortunately, I tried to insert a cube with these collisions, but nothing.
When I test on the ipad the collisions don’t work unfortunately.
Your cube is not your root in this case, it’s got to go here:
I put the cube in the root but unfortunately the colliders still don’t work when I test in app.
No worries, I’ll prepare you a little project this evening showing off how you can do this, and then I’ll explain why it functions the way it does.
Thank you very much! You’re so kind
For anyone who might have my problem, I solved it by putting a collision box as root, then putting “trace complex collision” on true, deleted the start player and inserted the pawn into the scene by putting it in class player 0. For framing then I simply moved the camera inside the pawn to where I had the start player before.
I would still like to thank those who have given me assistance so far.