Camera collision with animated object

I have a scene with animated doors. Moving around with the internal collision system enabled and collision meshes on the doors, the camera ellipsoid collides correctly with the door. However, when I trigger the animation, the door can move/rotate through the camera collider. If i move the camera position at the same time i get somewhat of an effect, but I need this to happen also when the camera is not moving, so my “camera character” will be pushed away.

As far as I can tell this is because the cameras collision is only checked when the camera is moving because it is only ment for collision with static objects. I looked at moveWithCollision, but that is ment for moving objects but respecting collisions as far as I could tell, so basicaly what the camera collision is doing under the hood already(?). So my thinking is that I can use onCollide from the doors while they are animating, and check for the camera and move it away either from the door collision mesh or away from the hinge location of the door, effectively pushing it out of the door opening semicircle area.

So my question becomes this; Is this the best way of doing this, or have I missed some obvious setting somewhere, like turning on continous collision or something that would make this work “out of the box”? Or some other method that is “best practice”? I know I should ba able to do all this easily with physcs engines, but I would prefer to avoid the overhead of that.

I tried searching the forums and on the web, but could not find a clear answer, so sorry if i missed an obvious source.

Ahhhh ha ha ha. I once proposed spinWithCollisions(), a sister for moveWithCollisions(). Everyone looked at me like I was crazy! (actually, I am.) ScaleWithCollisions() is on the horizon, too. :open_mouth: None of those would work for this challenge, though.

Hi Elk. No solutions yet, but here’s a test playground. (Bad layerMask work by Wingnut Industries) :slight_smile:

Scene has collisionsEnabled and .checkCollisions = true on both big-door and primary camera 1.

Gray cone (seen in minimap) is aligned with camera 1 view, and is parented to camera 1.

So, if we get the swinging door to smack camera 1 (and push it), we will see the gray cone pushed from the minimap view… like a rain droplet wiper’d from a wet windshield.

I’m not sure if this is possible, using the ellipse colliders. Maybe. MoveWithCollisions() won’t “push” things, so, hmm.

Carry on, challenge yet unsolved. Stay tuned for more/better comments/ideas.

1 Like

Hi Wingnut. That is what i was “afraid” of, but I like the fact that there is a simpler mor performant alternative to physics, so i guess there has to be a limit to what it will do out of the box. As far as I have gathered from examples the moveWithCollision just means move/translate, but keep the collision objects in mind so they won’t interesct, and it does not actualy move what you collide with in any way, say like snow to a snow plower, witch was my initial assumption from the name.

Your analogy with raindrops on a windshilde is spot on, this is excactly what I need. I am trying to set up a framework of sorts for architectual visualisation, so the acuracy of the movement is less importen. I did not want to go down that road if there was just a simple setting or option i missed, but I was thinking to check the collisions from the door to the “player” and maybe moving the player away from where the hinges would be,and maybe a smidge of the “normal” direction of the collision point, if I can get thet info from onCollide!? That should also hopefully prevent the player from getting stuck in a corner for instance.

Thanks for the playground, I will try checking it out more tomorrow, and see what I can some up with :slight_smile:

Also, thanks for the minimap, was thinking of somthing like that to see where in the apartment or house you were actualy at :slight_smile:

1 Like