Camera Collison

Mattis

Member
Hey!

When I changed the "look ofset" to postion the camera like the way in Army of two, the camera collison is completely crazy, when I walked near a car or house the camera jumps all over the place, the collision radius dont help really and not the anchor or offset neither, I get it fine for the car, but when Im near the house the camera gets moved forward and enters the house... Wich settings should I try out?
 

Justin

Administrator
Staff member
Do you have any colliders which could be causing unnatural collisions. In the demo scene I gave a look offset of (2, 0, -2.5) and it worked.
 

Andrew

Moderator
Staff member
Hm can you reproduce this in the demo scene at all? Check it against a simple box collider instead of any complex mesh colliders. And double-check your layers and whatnot in case it's colliding with meshes you expect it not to.
 

Justin

Administrator
Staff member
Can you tell us how to reproduce it within the demo scene? There are mesh colliders in that scene so it should provide a good test.
 

Andrew

Moderator
Staff member
Any reason why you set the position and obstruction position smoothing values to 0? Those tend to help with smoothing the camera movement. Try increasing those values. This is what they're set to in the demo:

1613554195532.png

If you have a large, complex mesh with a lot of tris then you're likely to end up with this issue in any case. It's unlikely you need the collider for the house to be that complex. It's generally best to replace those sorts of colliders with a few simple box colliders. This will increase performance, reduce the risk of collision issues like this one (and unexpected collisions with the character) and make your scene easier to edit.
 

Mattis

Member
The reason why position smooth ing is 0, it's because when you have positioned the camera like that and aim and move around the camera moves too much and the character goes off screen, I want to have it still like in any other tps game, and this is the only way I could achieve it.
 

Justin

Administrator
Staff member
It looks like you are setting the Anchor Offset and not the Look Offset. This will do a collision detection in a direction that you are not expecting. You should adjust the Look Offset to the value of your Anchor Offset.
 

Mattis

Member
Yes it's shooting the camera thrue the object it should evade... i don't understand, anchor should be 000? How can I achieve this tps look? Pic in a sec.
 

Justin

Administrator
Staff member
You should adjust the Look Offset, rather than the Anchor Offset. It is going to fire a ray from the Look Offset to the Anchor Offset, and since your Anchor Offset is not near your character there is going to be unexpected collisions.

In the demo scene I adjusted the Look Offset to an extreme value and it worked.
 

Mattis

Member
Still not working , now the camera get stuck and the character keeps walking insted of a pretty collision detection
 

Mattis

Member
Change it to 0.5 and the anchor 000. Now it works but camera goes down into ground.. maybe set the anchor offset Y?
 

Mattis

Member
Got it working!!! Thanks guys! It look quite good now, a bit twitchy with complex mesh. Maybe a tell some intern to change to regular colliders on my houses :D keep a eye out for my gameplay trailer!! Will post here on the forum :) have a good day!
 
Top