I want to position a box within a floor and 4 walls so the boxes movements would be within a constraint. This example shows a floor and backwall and works fine. However. I want to add left/right and front wall, so it can't exceed those bounds.
Adding in <PhyPlane color="lightblue" position={[0, 0, 10]} />
Which would add another plane near the user sends the physics boxes haywire. They get pushed out of the current camera view and don't just drop down like the original example.
But the boxes are within the 3 planes so it doesn't make sense why they're affected by the plane hitboxes.
How can I create a boundary plane box around a box so it won't move past that size. Like if the box is 10x10, if it hits the sides then it'd just interact like a normal physics object hitting a wall.
EDIT
Even with just 2 planes, <PhyPlane color="lightblue" position={[0, 0, 10]} />
modifying the existing backplane to be a frontplane with that code, the box object shoots off into nowhere.
I wonder if the issue is the rendering order of everything. So, ALL objects would render into the scene at exactly the same time. Both the box and the plane start at origin [0, 0, 0]
, then the plane moves to [0, 0, 10]
, which would push the box in that direction.
Can the plane be set not register any items until it reaches it's intended position?
Seems that, if I set the mass to be 0, or type not to be dynamic, the boxes wouldn't get initially pushed by the planes. Then I'd just need to set the type back to dynamic after the scene loaded up.