Plane does not exist but works anyway

I have created some planes in CGE to set up borders of limitation for moving transforms. (sprites).
Depending on the situation I would like to switch them off so the transform can pass it.
But when I use Plane.Exists := False the limitation is still there. Is this a bug with the planes and if not: how can I switch off planes on runtime?

RightPlane.Exists := false; // it has to be inactive

     if (PlayerTransform.WorldBoundingBox.Max.X >= RightPlane.Translation.X) then
     begin
       StandRight;
       PlayerText.Caption:= 'I cannot get to the right any further.';
     end;

The limitation is still there.

RightPlane := DesignedComponent (‘Plane4’) as TCastlePlane;

note that this condition doesn’t know if the plane is active or not. RightPlane.Exists = false handles the way its Update and Render work, but does not disallow you to ask for its properties. And they are all there, nothing gets lost.

So in your situation you should do something like:

if RightPlane.Exists and (PlayerTransform.WorldBoundingBox.Max.X >= RightPlane.Translation.X) then
begin
  StandRight;
  PlayerText.Caption:= 'I cannot get to the right any further.';
end;

Thanks for quick response!
Yes, this works, thanks!
:slight_smile:

1 Like