# Problem with the BoxImpostors

## Recommended Posts

Hello everybody,

I am trying to realize a maze with Babylon.js and Oimo. In this maze, the player control a ball and try to reach a cube (the arrival). I have my ground, my walls, my ball and my cube and I put some BoxImpostors on walls to create an real wall and obstacle. But it seems that the impostors don't follow the structure of my walls. I don't understand and I hope you could help me.

Thanks

On the picture, i put two box impostors in red (each wall is a box) but the ball can go through it and the blue line is an obstacle, the ball can't go through the blue line. Is there a solution to this problem, with or without the boximpostors ?

Sur l'image, les boxImpostors sont en rouges (chaque mur est une box) mais la balle peut traverser ces murs et la ligne bleue représente ce que la balle ne peut pas traverser. Y a t-il une solution à ce problème, avec ou sans les boxImpostors ?

// French

Bonjour tout le monde,

Je suis en train de réaliser un labyrinthe avec Babylon.js et Oimo. Dans ce labyrinthe, le joueur contrôle une balle et essay d'atteindre un cube (l'arrivée). J'ai mon sol, mes murs, ma balle et mon cube et j'ai ajouté des BoxImpostors sur les murs pour créer un vrai mur infranchissable par la balle. Mais il semblerait que les impostors ne suivent pas la structure de mes murs. Je ne comprends pas et j'espère que vous pourrez m'aider.

Merci

##### Share on other sites

I found one part of the problem, I assume that the boxImpostor doesn't follow the rotation of the wall and keep the start position of each wall. I try to use the updatePhysicsBodyPosition method after my rotation but it' doesn't work.

##### Share on other sites

I had a very similar problem. The problem was the The Oimo-Plugin only updated the rotation of the object after the object was locally updated. This is actually an Oimo bug (the functions there sometimes don't do what you would expect them to).

I assume the blue line doesn't have a rotation / rotation is 0,0,0 - right?

I fixed it for quaternion usage with this commit - https://github.com/BabylonJS/Babylon.js/commit/9053660d46e5c22e17f119d9ba39a8c09a4be4bd . Try using quaternions instead of the regular rotation and see if it solves your problem. If not, try creating a demo in the playground to simulate the situation and we will debug it together.

##### Share on other sites

I assume the blue line doesn't have a rotation / rotation is 0,0,0 - right?

I fixed it for quaternion usage with this commit - https://github.com/BabylonJS/Babylon.js/commit/9053660d46e5c22e17f119d9ba39a8c09a4be4bd . Try using quaternions instead of the regular rotation and see if it solves your problem. If not, try creating a demo in the playground to simulate the situation and we will debug it together.

yes, it's correct. I found a solution with a new way to scale  my walls. I used this before    wallV_2.scaling = new BABYLON.Vector3(200,30,1); and now i use wallV_2.scaling.z = 200; wallV_2.scaling.y = 30; It's a way to avoid the rotation and that works perfectly. But i think i will use your solution and try it. For the moment, the problem is fixed. Thanks for your help

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.