[SOLVED] Access Spatial of VehicleControl

Hey :slight_smile:

I’ll be straightforward.

public class PlayerCarControl extends VehicleControl {

  void someCustomMethod {
               if (this.spatial == null)
                       system.out.print ("Can you help me access my Spatial ?")

               else
                       this.spatial.rotate (pi,0,pi);     
  }

}

And in main:

carNode.addControl(PlayerCarControl );

.
.
.

Output: Can you help me access my Spatial ?

1 Like

Time to use a debugger. Was setSpatial() invoked before someCustomMethod()? And if so, on what instance of VehicleControl? And what value did its parameter have?

2 Likes

@sgold, I listened to your advice and solved the problem.

I would like to thank you for your help.

Have a wonderful day :chimpanzee_cool:

1 Like